locale property Null safety

  1. @override
Locale locale
override

The system-reported default locale of the device.

This establishes the language and formatting conventions that application should, if possible, use to render their user interface.

This is the first locale selected by the user and is the user's primary locale (the locale the device UI is displayed in)

This is equivalent to locales.first, except that it will provide an undefined (using the language tag "und") non-null locale if the locales list has not been set or is empty.

Implementation

@override
ui.Locale get locale => _localeTestValue ?? _platformDispatcher.locale;