load method

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

Load translations for locale.

The map may be nested, in which case it is flattened into dot-separated keys when merged - see AssetLocalizations.flatten. Returning a flat Map<String, String> remains valid.

Implementation

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

  // Decoded as-is, so nested translations survive to be flattened on merge.
  return json.decode(jsonString) as Map<String, dynamic>;
}