Make internal cache vars private (flutter/engine#15699)

This commit is contained in:
Dan Field 2020-01-16 16:10:25 -08:00 committed by GitHub
parent c11bbb2872
commit 0eb30b4fcd

View File

@ -483,8 +483,8 @@ class Locale {
@override
int get hashCode => hashValues(languageCode, scriptCode, countryCode);
static Locale cachedLocale;
static String cachedLocaleString;
static Locale _cachedLocale;
static String _cachedLocaleString;
/// Returns a string representing the locale.
///
@ -493,11 +493,11 @@ class Locale {
/// purposes only. For parseable results, use [toLanguageTag] instead.
@override
String toString() {
if (!identical(cachedLocale, this)) {
cachedLocale = this;
cachedLocaleString = _rawToString('_');
if (!identical(_cachedLocale, this)) {
_cachedLocale = this;
_cachedLocaleString = _rawToString('_');
}
return cachedLocaleString;
return _cachedLocaleString;
}
/// Returns a syntactically valid Unicode BCP47 Locale Identifier.