TranslationLoader.restClient constructor

TranslationLoader.restClient({
  1. Authorizer? authorizer,
  2. Client? client,
  3. Reporter? reporter,
  4. required Request request,
  5. int retryCount = 0,
  6. Duration retryDelay = const Duration(seconds: 1),
  7. DelayStrategy? retryDelayStrategy,
  8. Duration? timeout,
})

A more powerful version of the simple network factory. Tihs gives full control over the way the network call is executed. This stillrequires the response from the network call result in a JSON key / value map.

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 RestClientTranslationLoader directly.

Implementation

factory TranslationLoader.restClient({
  Authorizer? authorizer,
  Client? client,
  Reporter? reporter,
  required Request request,
  int retryCount = 0,
  Duration retryDelay = const Duration(seconds: 1),
  DelayStrategy? retryDelayStrategy,
  Duration? timeout,
}) =>
    RestClientTranslationLoader(
      authorizer: authorizer,
      client: client,
      reporter: reporter,
      request: request,
      retryCount: retryCount,
      retryDelay: retryDelay,
      retryDelayStrategy: retryDelayStrategy,
      timeout: timeout,
    );