FlutterGen / flutter_gen

The Flutter code generator for your assets, fonts, colors, … — Get rid of all String-based APIs.
https://pub.dev/packages/flutter_gen
MIT License
1.46k stars 146 forks source link

[BUG]: SvgPicture.asset generated code not compatible with latest flutter_svg #368

Closed jetpeter closed 1 year ago

jetpeter commented 1 year ago

Is there an existing issue for this?

Version

5.2.0

Command type

build_runner (Default)

What happened?

Generated code has: The argument type 'Clip?' can't be assigned to the parameter type 'Clip'.

This is casued by flutter_svg changing the parameter Clip? to Clip: clipBehavior = Clip.hardEdge and removing the deprecated annotation.

https://github.com/dnfield/flutter_svg/blame/master/lib/svg.dart#L181

See flutter_svg 2.0.4

Relevant a pubspec.yaml.

No response

Relevant log output

No response

Code of Conduct

komaxx commented 1 year ago

Same Issue. For what it's worth: Releasing an update with a (breaking) method signature change as only a patch update (2.0.3 to 2.0.4) is a mistake.

cogivn commented 1 year ago

Hi, may I know when the issue will be resolved? Thanks,

jetpeter commented 1 year ago

It will probably be a few days+. Easy fix is to change your flutter_svg from ^2.0.x to 2.0.3 without the carrot so it uses that exact version. 2.0.3 will work with the current flutter_gen.

cyrilnoah1 commented 1 year ago

@FlutterGen team, when can we expect this to be resolved?

dev-nicelee commented 1 year ago

For someone who is still stuck with this bug, there is on review PR which will resolve this issue.

(It's a bit hack though..) You can temporarily change clipBehavior in asset.g.dart file like below.

Clip clipBehavior = Clip.hardEdge,
yauheniprakapenka commented 1 year ago

I am using code generation. As a temporary solution, these steps are helped me to fix the errors:

Error: The argument type 'Clip?' can't be assigned to the parameter type 'Clip' because 'Clip?', colorFilter Error: No named parameter with the name 'colorFilter'.

1) Specify versions of flutter_gen_runner: 5.1.0+1 (without carrot) and flutter_svg: 1.1.4 (without carrot) 2) Go to local pub cache and remove all flutter_gen and flutter_svg versions (for example, my path is /Users/eprakopenko/.pub-cache/hosted/pub.dev) 3) flutter clean 4) flutter pub get 5) flutter pub run build_runner build --delete-conflicting-outputs

minhnguyenandpad commented 1 year ago

Any update for this?

abdulrojakdev commented 1 year ago

Any update for this?