TranslationLoader.asset constructor

TranslationLoader.asset(
  1. String asset, {
  2. String? package,
})

Creates a TranslationLoader instance that loads from local asset files. When loading from a package, you must pass the name of the package via the package optional parameter. The asset must be a JSON key / value map.

This loader is technically blocking, but extremely fast assuming the JSON asset is not crazy massive. For most use cases, this can be treated as if it is a non-blocking loader.

This is a convenience factory constructor and is ultimately a synonym for constructing an AssetTranslationLoader directly.

Implementation

factory TranslationLoader.asset(
  String asset, {
  String? package,
}) =>
    AssetTranslationLoader(
      asset,
      package: package,
    );