NetworkTranslationLoader constructor

NetworkTranslationLoader(
  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.

Implementation

NetworkTranslationLoader(
  this.url, {
  this.headers,
});