TranslationBindings constructor

TranslationBindings({
  1. AppleTranslationHostApi? host,
  2. AppleTranslationPlatformApi? platform,
  3. bool registerCallbacks = true,
})

Creates bindings, defaulting to the real platform channels.

Pass registerCallbacks: false in tests that drive callbackHandler directly.

Implementation

TranslationBindings({
  AppleTranslationHostApi? host,
  AppleTranslationPlatformApi? platform,
  bool registerCallbacks = true,
}) : host = host ?? AppleTranslationHostApi(),
     platform = platform ?? AppleTranslationPlatformApi() {
  if (registerCallbacks) {
    AppleTranslationCallbackApi.setUp(callbackHandler);
  }
}