How to solve firebase_auth PlatformException(channel-error, Unable to establish connection...) error?

Viewed 138

When trying to run my flutter application I receive the following error:

[ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: PlatformException(channel-error, Unable to establish connection on channel., null, null)

Here is an extract of my current pubspec.yaml with relevant parts:


environment:
  sdk: ">=2.17.5 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  firebase_auth: ^3.4.2
  firebase_core: ^1.19.2

  provider: ^6.0.0

  cupertino_icons: ^1.0.2
  

dev_dependencies:
  flutter_test:
    sdk: flutter

  flutter_lints: ^2.0.0

flutter:

  uses-material-design: true

I am trying to login with email and password using firebase_auth but ever since I have started using firebase, my app loads to a white, blank page.

I have tried running flutter clean and reinstalling the packages using pub get but the same error persists. And when I run flutter pub outdated, it states I have no outdated dependancies.

My main.dart initial function to run the app:

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp(
    options: FirebaseOptions(
        apiKey: 'AIzaSyDywKRZf...',
        appId: '1:574402216485:android:f10c99e7142f...',
        messagingSenderId: '5744022...',
        projectId: 'receiptcamp'),
  );
  runApp(MyApp());
}

I have seen some other posts (another SO issue, github issue, another SO issue) here regarding similar issues with this dependancy but none of those solutions have worked for me so far.

0 Answers
Related