flutter_gen icon indicating copy to clipboard operation
flutter_gen copied to clipboard

[BUG]: Latest flutter_svg requires parameter `theme` on SvgPicture.asset to be non-nullable

Open mrkahfi opened this issue 2 years ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Version

5.2.0

Command type

Dart command

What happened?

Hi, for some reason I am using the latest version of flutter_gen_runner and flutter_svg.

However when I ran command:

fluttergen -c pubspec.yaml

It succcessfully generated the assets.gen.dart file containing 1 error, which is:

The argument type 'SvgTheme?' can't be assigned to the parameter type 'SvgTheme'

Seems like the latest flutter_svg requires the parameter theme to be non-nullable.

Of course this can be easily fixed by hand by making the parameter theme required and non-nullable. But we're looking forward to get flutter_gen compatible with the latest version of flutter_svg.

Relevant a pubspec.yaml.

dependencies:
  flutter_svg: ^2.0.4 # Latest version as of now

dev_dependencies:
  flutter_test:
    sdk: flutter

  flutter_gen_runner: ^5.2.0  # Latest version as of now

flutter_gen:
  output: lib/gen/ # Optional (default: lib/gen/)
  line_length: 80 # Optional (default: 80)

  integrations:
    flutter_svg: true

flutter:
  assets:
    - assets/images/

Relevant log output

The argument type 'SvgTheme?' can't be assigned to the parameter type 'SvgTheme'

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

mrkahfi avatar Mar 23 '23 15:03 mrkahfi

Same here image

actual in flutter_gen_runner: ^5.3.1

subzero911 avatar Jul 04 '23 12:07 subzero911

This was fixed in https://github.com/FlutterGen/flutter_gen/pull/350

bramp avatar Oct 14 '23 04:10 bramp