init method
Initialize the list of mapLocale (see MapLocale model for info) and initLanguageCode code when the app is start up. Both field will required.
initLanguageCode mostly passed from the shared_preferences for checking the init language to display when the app is start up.
Implementation
Future<void> init({
required List<MapLocale> mapLocales,
required String initLanguageCode,
}) async {
FlutterLocalizationTranslator.instance.mapLocales = mapLocales;
_supportedLocales = mapLocales.map((e) => e.locale).toList();
mapLocales.forEach((e) {
_fontFamily.putIfAbsent(e.languageCode, () => e.fontFamily);
});
final initCountryCode = _getCountryCode(initLanguageCode);
final initScriptCode = _getScriptCode(initLanguageCode);
await _handleLocale(initLanguageCode, initCountryCode, initScriptCode);
}