Firebase PlatformException(channel-error, Unable to establish connection on channel., null, null) in native iOS app with Flutter module

Viewed 1261

I am adding a Flutter module to a native iOS app and receiving the following exception:

[VERBOSE-2:ui_dart_state.cc(198)] Unhandled Exception: PlatformException(channel-error, Unable to establish connection on channel., null, null)
#0      FirebaseCoreHostApi.initializeCore (package:firebase_core_platform_interface/src/pigeon/messages.pigeon.dart:205:7)
<asynchronous suspension>
#1      MethodChannelFirebase._initializeCore (package:firebase_core_platform_interface/src/method_channel/method_channel_firebase.dart:29:44)
<asynchronous suspension>
#2      MethodChannelFirebase.initializeApp (package:firebase_core_platform_interface/src/method_channel/method_channel_firebase.dart:73:7)
<asynchronous suspension>
#3      Firebase.initializeApp (package:firebase_core/src/firebase.dart:40:31)
<asynchronous suspension>
#4      main (package:flutter_module/main.dart:10:3)
<asynchronous suspension>

The Flutter module as standalone app is running totally fine and initializing Firebase, but not when integrated into the native iOS app.

My problem is similar to this one, but only occuring as an add-to-app module: Calling Firebase.initializeApp() returns 'Unable to establish connection on channel' - Flutter + Firebase

1 Answers

I could solve it by adding the following line in the native iOS app:

GeneratedPluginRegistrant.register(with: flutterEngine)
Related