diff --git a/packages/flutter/lib/src/material/theme_data.dart b/packages/flutter/lib/src/material/theme_data.dart index 94f0e01328e..8a96051d6eb 100644 --- a/packages/flutter/lib/src/material/theme_data.dart +++ b/packages/flutter/lib/src/material/theme_data.dart @@ -1465,13 +1465,6 @@ class ThemeData with Diagnosticable { Color get toggleableActiveColor => _toggleableActiveColor!; final Color? _toggleableActiveColor; - // The number 5 was chosen without any real science or research behind it. It - - // copies of ThemeData in memory comfortably) and not too small (most apps - // shouldn't have more than 5 theme/localization pairs). - static const int _localizedThemeDataCacheSize = 5; - /// Caches localized themes to speed up the [localize] method. - /// Creates a copy of this theme but with the given fields replaced with the new values. /// /// The [brightness] value is applied to the [colorScheme]. @@ -1708,7 +1701,14 @@ class ThemeData with Diagnosticable { bottomAppBarColor: bottomAppBarColor ?? _bottomAppBarColor, ); } + + // The number 5 was chosen without any real science or research behind it. It // just seemed like a number that's not too big (we should be able to fit 5 + // copies of ThemeData in memory comfortably) and not too small (most apps + // shouldn't have more than 5 theme/localization pairs). + static const int _localizedThemeDataCacheSize = 5; + + /// Caches localized themes to speed up the [localize] method. static final _FifoCache<_IdentityThemeDataCacheKey, ThemeData> _localizedThemeDataCache = _FifoCache<_IdentityThemeDataCacheKey, ThemeData>(_localizedThemeDataCacheSize);