ilteoood / flutter_i18n

I18n made easy, for Flutter!
MIT License
217 stars 57 forks source link

Error while build for web #159

Closed Aerofluxx closed 3 years ago

Aerofluxx commented 3 years ago

Hello,

after the upgrade to Flutter 2.0.0 (on beta channel) or also to Flutter 2.1.0 (on master channel) with the new version of flutter_i18n (flutter_i18n: ^0.22.2) I can't build for web anymore.

Working fine with MacOS build, but with the flutter_web I'm getting:

Launching lib/main.dart on Chrome in debug mode...
lib/main.dart:1
../../../.pub-cache/hosted/pub.dartlang.org/flutter_i18n-0.22.2/lib/loaders/translation_loader.dart:26:43: Error: A value of type 'Locale?' can't be assigned to a variable of type 'Locale' because 'Locale?' is nullable and 'Locale' isn't.
 - 'Locale' is from 'dart:ui'.
    final Locale systemLocale = ui.window.locale;
                                          ^
Failed to compile application.
Exited (sigterm)

EDIT: Found that version flutter_i18n: 0.22.0 is working fine The problem above occurs with 0.22.1 and 0.22.2 ... hope this helps

Note: My source is not fully migrated to null-safety, maybe that's a problem too?

Thank you for your support

ilteoood commented 3 years ago

Hi @Aerofluxx, seems that they used two different signature for ui.window.locale.

I'm working on it, hope to release a fix asap.

ilteoood commented 3 years ago

It should be fixed with 0.22.3

Aerofluxx commented 3 years ago

@ilteoood Maybe this gets reopened, sorry if so, but I just wanna say thank you Matteo, works great again!

Edit: Nice it won't get reopened. 👍