localizely / flutter-intl-intellij

This Android Studio & IntelliJ plugin generates boilerplate code for localization of Flutter apps with official Dart Intl library
MIT License
129 stars 4 forks source link

Support for Flutter 3.10 & Dart 3.0 #97

Closed aldee closed 1 year ago

aldee commented 1 year ago

Hi, since Flutter 3.10 is here, when I tried to use the plugin, it shows an error because the command executed by the plugin limits intl_utils activation only if its within version range ">=1.0.0 <2.0.0", which doesn't support null-safety, which is required by Dart 3.0

Here's the error message that shows up:

`flutter --no-color pub global activate intl_utils ">=1.0.0 <2.0.0" Package intl_utils is currently active at version 2.8.2. Resolving dependencies... The current Dart SDK version is 3.0.0.

Because pub global activate depends on intl_utils <2.0.0 which doesn't support null safety, version solving failed.

The lower bound of "sdk: '>=2.2.2 <3.0.0'" must be 2.12.0 or higher to enable null safety.`

Here's the output from flutter doctor --verbose:

`[✓] Flutter (Channel stable, 3.10.0, on macOS 13.3.1 22E772610a darwin-arm64, locale en-ID) • Flutter version 3.10.0 on channel stable at /Users/xxx/fvm/versions/stable • Upstream repository https://github.com/flutter/flutter.git • Framework revision 84a1e904f4 (2 days ago), 2023-05-09 07:41:44 -0700 • Engine revision d44b5a94c9 • Dart version 3.0.0 • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2) • Android SDK at /Users/xxx/Library/Android/sdk • Platform android-33, build-tools 33.0.2 • ANDROID_HOME = /Users/xxx/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3) • Xcode at /Applications/Xcode-14.3.app/Contents/Developer • Build 14E222b • CocoaPods version 1.12.1

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

[✓] Android Studio (version 2022.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 17.0.6+0-17.0.6b802.4-9586694)

[✓] IntelliJ IDEA Ultimate Edition (version 2022.1) • IntelliJ at /Applications/IntelliJ IDEA.app • Flutter plugin version 66.0.4 • Dart plugin version 221.5588

[✓] VS Code (version 1.78.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension can be installed from: 🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (2 available) • macOS (desktop) • macos • darwin-arm64 • macOS 13.3.1 22E772610a darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 113.0.5672.92

[✓] Network resources • All expected network resources are available.

• No issues found!`

lzoran commented 1 year ago

Hi @aldee,

It seems that you have sdk set to>=2.2.2 <3.0.0 within your pubspec.yaml file. Is there any reason why it is not set to at least >=2.12.0 <3.0.0 as you are using the latest Flutter version?

The Flutter Intl plugin determines which version of the intl_utils package (package used for generating the localization code) to globally activate based on the sdk value (null-safety requires at least min value of the 2.12.0) within the pubspec.yaml file, or by using the same version of the intl_utils package that is listed as a dependency within the pubspec.yaml file.

So, updating the version of sdk to >=2.12.0 <3.0.0 or adding the intl_utils package as a dev dependency (e.g. intl_utils: ^2.8.2) should solve the issue.

Hope this info helps!

aldee commented 1 year ago

Hi, thanks for your response.

In my pubspec.yaml, I already set the sdk to >=3.0.0-0 <4.0.0

But I've added intl_utils package as dev_dependency, and it works now. Thank you!

Although I'm still curious about why it resolved to that sdk range when running intl_utils, when even in my pubspec.lock file it resolved to >=3.0.0-0 <4.0.0

lzoran commented 1 year ago

Good catch!

It looks like the code for resolving which version of the intl_utils to activate needs to be updated to also include the latest Dart versions (>=3.0.0).

Let's leave this issue open until we fix it.

aldee commented 1 year ago

I see, alright then. Thanks again for your help!

philitell commented 1 year ago

Good catch!

It looks like the code for resolving which version of the intl_utils to activate needs to be updated to also include the latest Dart versions (>=3.0.0).

Yes please!!!

lzoran commented 1 year ago

This should be fixed now with the Flutter Intl 1.18.2.

Closing this issue as resolved. In case of irregularities, feel free to open it again.