Skip to content

AssetLocalizationLoader

A LocalizationLoader which can load translations from file assets bundles. Remember to add the language file assets to the pubspec.yaml file.

Implemented types

Constructors

AssetLocalizationLoader

const AssetLocalizationLoader({
  1. String basePath = 'assets/lang',
})

Create a asset location loader. Loads from assets/lang per default.

Properties

basePath

String basePath
final

Methods

load

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.