INNER CODE UNIT · Dart
of
Furqankhanzada/flutter_eCommerce_ui_kit · lib/localizations.dart:14
static AppLocalizations? of(BuildContext context) {
return Localizations.of<AppLocalizations>(context, AppLocalizations);
}
// Static member to have a simple access to the delegate from the MaterialApp
static const LocalizationsDelegate<AppLocalizations> delegate =
AppLocalizationsDelegate();
late Map<String, String> _localizedStrings;
Future<bool> load() async {
// Load the language JSON file from the "lang" folder
String jsonString =
await rootBundle.loadString('assets/i18n/${locale.languageCode}.json');
Map<String, dynamic> jsonMap = jsonDecode(jsonString);
_localizedStrings = jsonMap.map((key, value) {
return MapEntry(key, value.toString());