toString method Null safety

  1. @keepToString
  2. @override
String toString()
@keepToString, override

Returns a string representing the locale.

This identifier happens to be a valid Unicode Locale Identifier using underscores as separator, however it is intended to be used for debugging purposes only. For parsable results, use toLanguageTag instead.

Implementation

@keepToString
@override
String toString() {
  if (!identical(_cachedLocale, this)) {
    _cachedLocale = this;
    _cachedLocaleString = _rawToString('_');
  }
  return _cachedLocaleString!;
}