-
Notifications
You must be signed in to change notification settings - Fork 88
Closed
Description
Currently the implementation of load()
function returns Future
static Future<L10n> load(Locale locale) {
final name = (locale.countryCode?.isEmpty ?? false)
? locale.languageCode
: locale.toString();
final localeName = Intl.canonicalizedLocale(name);
return initializeMessages(localeName).then((_) {
Intl.defaultLocale = localeName;
final instance = L10n();
L10n._current = instance;
return instance;
});
}
However, this causes a black frame to appear just before the MaterialApp renders (e.g. like here, but I see this also in our app when we rebuild MaterialApp).
This is frame by frame view of our app when the MaterialApp is rebuilt:
CleanShot.2022-10-05.at.15.30.33.mp4
It should by default return SynchronousFuture (see example here). I succeeded with something like this:
static Future<L10n> load(Locale locale) {
final name = (locale.countryCode?.isEmpty ?? false)
? locale.languageCode
: locale.toString();
final localeName = Intl.canonicalizedLocale(name);
initializeMessages(localeName).then((_) {
Intl.defaultLocale = localeName;
final instance = L10n();
L10n._current = instance;
return instance;
});
return SynchronousFuture<L10n>(L10n());
}
Would you need a reproducible example?
Metadata
Metadata
Assignees
Labels
No labels