init static method

void init(
  1. String path,
  2. String? responsePattern(
    1. Response
    ),
  3. Map<String, dynamic> bodyPattern(
    1. String,
    2. Locale
    ), {
  4. bool? automaticDetection,
  5. Map<String, dynamic>? headers,
  6. Locale? translateTo,
  7. required bool forceRefresh,
  8. required Duration cacheDuration,
  9. required HttpMethod method,
})

Implementation

static void init(String path, String? Function(Response) responsePattern,
  Map<String,dynamic> Function(String, Locale) bodyPattern,
    {bool? automaticDetection,
    Map<String, dynamic>? headers,
    Locale? translateTo,
    required bool forceRefresh,
    required Duration cacheDuration, required HttpMethod method}) {
  _instance = UniversalTranslatorController._()
    ..path = path
    .._responsePattern = responsePattern
    .._headers = headers
    .._bodyPattern = bodyPattern
    .._automaticDetection = automaticDetection
    .._forceRefresh = forceRefresh
    .._cacheDuration = cacheDuration
    .._translateTo = translateTo
    .._method = method;
  var window = WidgetsBinding.instance?.window ?? ui.window;
  _instance!._deviceLocation = window.locale;
}