load method

  1. @override
Future<Map<String, String>> load(
  1. Locale locale
)
override

Load translations for locale.

Implementation

@override
Future<Map<String, String>> load(Locale locale) async {
  String path = '$basePath/${locale.languageCode}.json';
  print("$runtimeType - loading '$path'");
  String jsonString = await rootBundle.loadString(path);

  Map<String, dynamic> jsonMap =
      json.decode(jsonString) as Map<String, dynamic>;
  Map<String, String> translations =
      jsonMap.map((key, value) => MapEntry(key, value.toString()));

  return translations;
}