Jesway / flutter_translate

Flutter Translate is a fully featured localization / internationalization (i18n) library for Flutter.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when building iOS app

JanBrin opened this issue · comments

Getting the following error after upgrading to 4.0.0:

../../../Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_translate-4.0.0/lib/src/utils/device_locale.dart:11:49: Error: Property 'window' cannot be accessed on 'WidgetsBinding?' because it is potentially null.
     - 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../Flutter/flutter/packages/flutter/lib/src/widgets/binding.dart').
    Try accessing using ?. instead.
      final deviceLocales = WidgetsBinding.instance.window.locales;

Flutter Doctor output:

Flutter (Channel stable, 2.10.5, on macOS 12.3.1 21E258 darwin-arm, locale
    en-DE)
    • Flutter version 2.10.5 at /Users/janbrinkmann/Flutter/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 5464c5bac7 (2 weeks ago), 2022-04-18 09:55:37 -0700
    • Engine revision 57d3bac3dd
    • Dart version 2.16.2
    • DevTools version 2.9.2

Yes it seems this issue occurs in stable channel.

Seems like 4.0.1 doesn't contain the changes i made

Fixed now in 4.0.2

Confirm, thanks for the quick response!

Hello, it seems like this bug is present again in 4.0.3