TranslationLoader.network constructor

TranslationLoader.network(
  1. String url, {
  2. Map<String, String>? headers,
})

Creates a TranslationLoader instance that loads from a URL. The URL must support returning a JSON key / value map via a GET call.

This optionally takes a map of headers that can be used for things like authorization, language, etc.

This is a blocking loader and will not resolve the Future until the translations are loaded. Wrap this in an AsyncTranslationLoader to avoid blocking the Translator on initialize, load, or reload.

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

Implementation

factory TranslationLoader.network(
  String url, {
  Map<String, String>? headers,
}) =>
    NetworkTranslationLoader(
      url,
      headers: headers,
    );