Closed absar closed 2 years ago
Hi @absar Thanks for reporting this! I don't have these issues with Flutter 3, so could you give me more info about your setup. Like:
flutter pub global list
Thanks for the quick response, strangely it shows intl_utils 1.9.0, doesn't the IDE plugin use the latest one?
Flutter Intl IDE plugni version: 1.17.2-2020.3
IDE version:
flutter pub global list: devtools 2.9.4 intl_utils 1.9.0
On further investigation this is what is happening. If I try to deactivate the package using flutter 2.10, it shows intl_utils 2.6.1, whereas 3 shows intl_utils 1.9.0, not sure why flutter 3 is using 1.9 on the same PC
Using flutter 2.10: flutter pub global deactivate intl_utils Deactivated package intl_utils 2.6.1
Using flutter 3: flutter pub global deactivate intl_utils Deactivated package intl_utils 1.9.0
I fixed it by running
flutter pub global activate intl_utils;
flutter --no-color pub global run intl_utils:generate
EDIT: That only really fixed the files but the files generated by this plugin are indeed still invalid.
I am facing the same issue too. The workaround proposed by jonasbark is working for me.
But we have to fix it from the plugin
I have managed to reproduce this problem.
The Flutter Intl plugin decides which version of the intl_utils
to use by looking at the min environment sdk version. If min version is >=2.12.0
, it uses intl_utils
that generates null-safe code (^2.0.0
), otherwise, it uses 1.9.0
.
Furthermore, if it fails to check this value for some reason, it checks if the Flutter version starts with 2. And I guess that that is the reason why plugin uses the intl_utils 1.9.0
in some cases.
This will be fixed soon (~ a few days until JetBrains approves it).
In the meantime, could you check if your min environment sdk version is properly formatted, and if not, if formatting it well helps?
The pubspec.yaml
file:
environment:
sdk: ">=2.16.0 <3.0.0" # check indentation and formatting here
@lzoran Same issue for our project. The formatting of the SDK version is correct.
The new release of the Flutter Intl plugin (1.17.3
) is available and it should fix this issue.
Updated plugin works, issue can be closed.
Generates uncompilable code in Flutter release 3 with latest flutter intl plugin, however it works fine if Flutter is downgraded to 2.10 l10n.dart Generated code with Flutter 3:
l10n.dart Generated code with Flutter 2.10: