init method Null safety
- dynamic assetBundle
Inits with the best available not-network references.
That means trying with assets and local database.
Implementation
Future<void> init(final AssetBundle assetBundle) async {
// trying the local database with the latest download language...
if (daoString != null) {
final String? latestLanguage =
await daoString!.get(_DAO_STRING_KEY_LANGUAGE);
if (latestLanguage != null) {
final bool successful = await _loadFromDatabase(latestLanguage);
if (successful) {
return;
}
}
}
// fallback: assets in English
await _loadFromAssets(assetBundle);
}