KingWu / gen_lang

gen_lang is a dart library for internationalization. Extracts messages to generate dart files required by Intl, inspired by Intl_translation and Flutter i18n
BSD 2-Clause "Simplified" License
100 stars 23 forks source link

The value 'null' can't be assigned to the parameter type 'I18nOption' because 'I18nOption' is not nullable. #22

Open kasperado1 opened 3 years ago

kasperado1 commented 3 years ago

Hello,

Getting the following error when trying to run flutter pub run gen_lang:generate

Failed to precompile gen_lang:generate:
Error: Cannot run with sound null safety, because the following dependencies
don't support null safety:

 - package:args
 - package:gen_lang
 - package:ansicolor

For solutions, see https://dart.dev/go/unsound-null-safety
/c:/flutter/.pub-cache/hosted/pub.dartlang.org/gen_lang-0.1.3/bin/generate.dart:17:35: Error: The value 'null' can't be assigned to the p
arameter type 'I18nOption' because 'I18nOption' is not nullable.
 - 'I18nOption' is from 'package:gen_lang/core_18n.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/gen_lang-0.1.3/lib/core_18n.dar
t').
  var parser = _generateArgParser(null);
                                  ^
pub finished with exit code 1

Running flutter pub run --no-sound-null-safety gen_lang:generate still gives the same error:

/c:/flutter/.pub-cache/hosted/pub.dartlang.org/gen_lang-0.1.3/bin/generate.dart:17:35: Error: The value 'null' can't be assigned to the p
arameter type 'I18nOption' because 'I18nOption' is not nullable.
 - 'I18nOption' is from 'package:gen_lang/core_18n.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/gen_lang-0.1.3/lib/core_18n.dar
t').
  var parser = _generateArgParser(null);
                                  ^
pub finished with exit code 254

flutter doctor Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel dev, 1.27.0-4.0.pre, on Microsoft Windows [Version 10.0.19042.804], locale en-AU) [√] Android toolchain - develop for Android devices (Android SDK version 30.0.3) [√] Chrome - develop for the web [√] Android Studio (version 4.1.0) [√] Connected device (3 available)

• No issues found!

Thanks! Damian

LaurentMalmendier commented 3 years ago

I had the same issue. I ran flutter pub get then flutter pub run build_runner build

Then flutter pub run gen_lang:generate worked