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

Null safety access to WidgetsBinding.instance

jiazhengshi opened this issue · comments

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;

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

@jiazhengshi - It seems this issue occurs in the stable channel and #85 fixes it.

thanks