Skip to content

The class 'FirebaseAuth' doesn't have a constructor named 'instance' (after creating GoogleSignIn()) #17080

@zeexan-dev

Description

@zeexan-dev

I get this error if try to create new FirebaseAuth instance after creating GoogleSignIn()
But it works fine if created before GoogleSignIn()

Screenshot

screenshot_1

pubspec dependencies

cupertino_icons: ^0.1.0
shared_preferences: ^0.4.1
charts_flutter: ^0.2.0
image_picker: 0.4.1
google_sign_in: 3.0.2
firebase_analytics: 0.3.3
firebase_auth: 0.5.5
firebase_database: 0.4.6
firebase_storage: 0.3.0

Run your application with flutter run and attach all the log output.

flutter analyze errors

error - The class 'FirebaseAuth' doesn't have a constructor named 'instance' at lib\main.dart:34:42 - new_with_undefined_constructor
error - Expected to find '(' at lib\main.dart:34:50 - expected_token

Flutter Doctor

[√] Flutter (Channel master, v0.3.6-pre.50, on Microsoft Windows [Version 10.0.16299.402], locale en-PK)
• Flutter version 0.3.6-pre.50 at C:\fluttersdk\flutter
• Framework revision c813eab (11 hours ago), 2018-04-27 22:55:51 -0700
• Engine revision 613aae0
• Dart version 2.0.0-dev.50.0.flutter-cd0c4e4fe1

[√] Android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android SDK at C:\Users\Muhammad Zeeshan\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-27, build-tools 27.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
• All Android licenses accepted.

[√] Android Studio (version 3.1)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 23.2.2
• Dart plugin version 173.4700
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)

[√] VS Code, 64-bit edition (version 1.22.2)
• VS Code at C:\Program Files\Microsoft VS Code
• Dart Code extension version 2.12.0

[√] Connected devices (1 available)
• TRT L21A • VWD7N17706001493 • android-arm • Android 7.0 (API 24)

For more information about diagnosing and reporting Flutter bugs, please see https://flutter.io/bug-reports/.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions