flutter_tagging icon indicating copy to clipboard operation
flutter_tagging copied to clipboard

dynamic function cant be assigned to Widget functions

Open mrcnee93 opened this issue 3 years ago • 21 comments

while deploying on android i get a gradle error

error:

../../.pub-cache/hosted/pub.dartlang.org/flutter_tagging-3.0.0/lib/src/tagging.dart:222:37: Error: The argument type 'dynamic Function(BuildContext, Widget, AnimationController?)?' can't be assigned to the parameter type 'Widget Function(BuildContext, Widget, AnimationController?)?'.

doctor:

Flutter (Channel stable, 2.2.0, on macOS 11.4 20F71 darwin-x64, locale it-IT) • Flutter version 2.2.0 at /Users/marco/fvm/versions/2.2.0 • Framework revision b22742018b (4 months ago), 2021-05-14 19:12:57 -0700 • Engine revision a9d88a4d18 • Dart version 2.13.0

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at /Users/marco/Library/Android/sdk • Platform android-30, build-tools 30.0.3 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 12.5.1, Build version 12E507 • CocoaPods version 1.10.1

[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.2) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)

[✓] VS Code (version 1.60.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.24.0

mrcnee93 avatar Sep 20 '21 09:09 mrcnee93

Did you resolve this issue..?

I am facing this on iOS Build.

marslannasr7koncepts avatar Oct 04 '21 10:10 marslannasr7koncepts

i just made a new pull request to solve this: https://github.com/sarbagyastha/flutter_tagging/pull/33 if it didn't got merged soon you could simply point to it in your pubspec file like this:

 flutter_tagging:
    git:
      url: https://github.com/mejdi14/flutter_tagging 

or do just modify the package by yourself like this: External libraries > flutter_tagging-3.0.0 > src > tagging.dart => replace dynamic by Widget in line 73

mejdi14 avatar Oct 04 '21 11:10 mejdi14

Thanks for this I am able to get rid of the error that I am facing..

marslannasr7koncepts avatar Oct 05 '21 07:10 marslannasr7koncepts

@mejdi14 thanks man this worked

ilyes9595 avatar Oct 05 '21 08:10 ilyes9595

@mejdi14 I am getting this

Error: Cannot run with sound null safety, because the following dependencies
don't support null safety:

 - package:flutter_tagging
 - package:flutter_typeahead_web

kamalbanga avatar Oct 11 '21 14:10 kamalbanga

@kamalbanga the package supports null safety, are you using the 3.0.0 versoin?

mejdi14 avatar Oct 11 '21 15:10 mejdi14

Yes, I was using 3.0.0 and was getting the transition builder error; then I tried your PR

flutter_tagging: ^3.0.0
  git:
    url: https://github.com/mejdi14/flutter_tagging

And I started getting this issue 👇🏽

Error: Cannot run with sound null safety, because the following dependencies
don't support null safety:

 - package:flutter_tagging
 - package:flutter_typeahead_web

It's quite confusing to me though, why I am getting this issue since yours is a PR on top of 3.0.0. which supports null safety.

kamalbanga avatar Oct 11 '21 15:10 kamalbanga

Yeah i just got the same problem now, that's weird, well you can try the second option in this case and update the library directly from your project till i can look into this

mejdi14 avatar Oct 11 '21 16:10 mejdi14

I am thinking of using the Autocomplete widget introduced in Flutter 2.0. It's the typeahead's alternative which package is used in this package. The whole tagging functionality will have to built on this and that's some work. The benefit could be desktop support.

One problem is its optionsBuilder (findSuggestions alternative) is sync and the usual real life use case is of course async.

kamalbanga avatar Oct 11 '21 17:10 kamalbanga

@mejdi14 Hey, I just noticed that there is no commit in this repo for the null safety release as in the pub.dev. That must be the reason, we are facing the cannot run with sound null safety issue.

kamalbanga avatar Oct 13 '21 16:10 kamalbanga

I made https://github.com/bradintheusa/flutter_tagging with the above fix and merged in the null changes from pub.dev.

bradintheusa avatar Oct 14 '21 19:10 bradintheusa

@mejdi14 and @bradintheusa great work! IOU1

twogood avatar Oct 15 '21 15:10 twogood

@mejdi14 @bradintheusa Guys I created this standalone tagging field class. It doesn't depend on any library, just Flutter 2.0's RawAutoComplete; it therefore would also work on desktop. Link to TagField gist

Screenshot 2021-11-13 at 11 06 56 AM Screenshot 2021-11-13 at 11 08 30 AM

kamalbanga avatar Nov 13 '21 05:11 kamalbanga

@mejdi14 thank you bro this worked perfectly

isa-sabbagh avatar Dec 06 '21 14:12 isa-sabbagh

Thanks @mejdi14 and @bradintheusa. I used the following in my pubspec.yaml to tag the specific commit I needed.

  flutter_tagging:
    git:
      url: https://github.com/bradintheusa/flutter_tagging 
      ref: 6a7d9dea5fff4f7de6f2142c667de6e5d9e61cec

deriegle avatar Dec 31 '21 18:12 deriegle

@mejdi14 Thanks you so much for your share, That's work for me

Licare093 avatar Feb 05 '22 16:02 Licare093

@mejdi14 or @bradintheusa, would it incur too much of a maintenance overhead to publish either of your versions as a new package (or create an org with a few maintainers)? This package no longer seems actively maintained. I'm willing to help out.

peter-mghendi avatar Apr 19 '22 03:04 peter-mghendi

@mejdi14 or @bradintheusa, would it incur too much of a maintenance overhead to publish either of your versions as a new package (or create an org with a few maintainers)? This package no longer seems actively maintained. I'm willing to help out.

peter-mghendi avatar Apr 19 '22 03:04 peter-mghendi

Yeah. I can do that. I should be able to do it today or tomorrow.

bradintheusa avatar Apr 19 '22 14:04 bradintheusa

It's live here: https://pub.dev/packages/flutter_tagging_plus

bradintheusa avatar Apr 20 '22 15:04 bradintheusa

@bradintheusa that's awesome, well done

mejdi14 avatar Apr 20 '22 15:04 mejdi14