Jesway / flutter_translate

Flutter Translate is a fully featured localization / internationalization (i18n) library for Flutter.
MIT License
403 stars 118 forks source link

Null safety access to WidgetsBinding.instance #83

Closed jiazhengshi closed 2 years ago

jiazhengshi commented 2 years ago

https://github.com/Jesway/Flutter-Translate/blob/master/lib/src/utils/device_locale.dart#L13

Try accessing using ?. instead.
  final deviceLocales = WidgetsBinding.instance.window.locales;
bratan commented 2 years ago

It's not necessary, neither the instance nor the window can be null. If this was the case it wouldn't compile otherwise.

bratan commented 2 years ago

@jiazhengshi - It seems this issue occurs in the stable channel and https://github.com/Jesway/Flutter-Translate/pull/85 fixes it.

jiazhengshi commented 2 years ago

thanks