UniversalTranslatorInit constructor

const UniversalTranslatorInit(
  1. String path, {
  2. required Widget builder(),
  3. required Map<String, dynamic> bodyPattern(
    1. String originalText,
    2. Locale translateTo
    ),
  4. required String? responsePattern(
    1. Response response
    ),
  5. Map<String, dynamic>? headers,
  6. bool? automaticDetection,
  7. Locale? translateTo,
  8. Duration cacheDuration = const Duration(days: 7),
  9. bool forceRefresh = false,
  10. HttpMethod method = HttpMethod.post,
})

Implementation

const UniversalTranslatorInit(this.path,
    {required this.builder,
    required this.bodyPattern,
    required this.responsePattern,
    this.headers,
    this.automaticDetection,
    this.translateTo,
    this.cacheDuration = const Duration(days: 7),
    this.forceRefresh = false,
    this.method = HttpMethod.post})
    : assert(automaticDetection == true || translateTo != null,
          'Please select a language to translate');