-1

I'm facing problem when i try to build my app when using firebase auth:

import 'package:firbasetest/user.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/cupertino.dart';
class authmethods{
  final FirebaseAuth auth =FirebaseAuth.instance;
  UserAuth userfromfirebase(User userz)
  {
    return userz!=null? UserAuth(userz.uid) :null;
  }
  Future signinWithEmailandPassword(String email, String passowrd) async
  {
    try{
      UserCredential result = await auth.signInWithEmailAndPassword(email: email, password: passowrd);
      User firebaseUser=result.user;
      return userfromfirebase(firebaseUser);
    }
    catch(e){print(e);}
  }

  Future signupwithemailandpassword(String email,String password) async
  {
    try{
      UserCredential result = await auth.createUserWithEmailAndPassword(email: email, password: password);
      User firebaseUser=result.user;
      return userfromfirebase(firebaseUser);
    }
    catch(e){print(e);}
  }

  Future signout() async
  {
    try{
      return await auth.signOut();
    }
    catch(e){print(e);}
  }
}

dependencies : cupertino_icons: ^1.0.0 firebase_core: ^0.7.0 firebase_auth: ^0.20.0+1

Error output :

/C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.20.0+1/lib/firebase_auth.dart:9:8: Error: Error when reading '/C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_platform_interface-3.0.1/lib/firebase_core_platform_interface.dart': The system cannot find the path specified.

import 'package:firebase_core_platform_interface/firebase_core_platform_interface.dart'; ^ /C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.20.0+1/lib/firebase_auth.dart:52:1: Error: Error when reading '/C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_platform_interface-3.0.1/lib/firebase_core_platform_interface.dart': The system cannot find the path specified.

export 'package:firebase_core_platform_interface/firebase_core_platform_interface.dart' ^ /C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.7.0/lib/firebase_core.dart:7:8: Error: Error when reading '/C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_platform_interface-3.0.1/lib/firebase_core_platform_interface.dart': The system cannot find the path specified.

import 'package:firebase_core_platform_interface/firebase_core_platform_interface.dart' ^ /C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.7.0/lib/firebase_core.dart:12:1: Error: Error when reading '/C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_platform_interface-3.0.1/lib/firebase_core_platform_interface.dart': The system cannot find the path specified.

export 'package:firebase_core_platform_interface/firebase_core_platform_interface.dart' ^ /C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.20.0+1/lib/src/firebase_auth.dart:8:28: Error: Type 'FirebasePluginPlatform' not found. class FirebaseAuth extends FirebasePluginPlatform { ^^^^^^^^^^^^^^^^^^^^^^ /C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.7.0/lib/src/firebase_app.dart:11:3: Error: Type 'FirebaseAppPlatform' not found. FirebaseAppPlatform _delegate; ^^^^^^^^^^^^^^^^^^^ /C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.7.0/lib/src/firebase_app.dart:34:3: Error: Type 'FirebaseOptions' not found. FirebaseOptions get options => _delegate.options; ^^^^^^^^^^^^^^^ /C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.7.0/lib/src/firebase.dart:16:10: Error: Type 'FirebasePlatform' not found. static FirebasePlatform delegatePackingProperty; ^^^^^^^^^^^^^^^^ /C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.7.0/lib/src/firebase.dart:18:10: Error: Type 'FirebasePlatform' not found. static FirebasePlatform /!/ get _delegate { ^^^^^^^^^^^^^^^^ /C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.7.0/lib/src/firebase.dart:41:27: Error: Type 'FirebaseOptions' not found. {String /?/ name, FirebaseOptions /?/ options}) async { ^^^^^^^^^^^^^^^ /C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth_platform_interface-3.0.1/lib/src/firebase_auth_exception.dart:11:37: Error: Type 'FirebaseException' not found. class FirebaseAuthException extends FirebaseException implements Exception { ^^^^^^^^^^^^^^^^^ /C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth_platform_interface-3.0.1/lib/src/method_channel/utils/exception.dart:27:1: Error: Type 'FirebaseException' not found. FirebaseException platformExceptionToFirebaseAuthException( ^^^^^^^^^^^^^^^^^ /C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.20.0+1/lib/src/firebase_auth.dart:24:38: Error: The getter 'pluginConstants' isn't defined for the class 'FirebaseAuth'.

  • 'FirebaseAuth' is from 'package:firebase_auth/firebase_auth.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.20.0+1/lib/firebase_auth.dart'). Try correcting the name to the name of an existing getter, or defining a getter or field named 'pluginConstants'. app: app, pluginConstants: pluginConstants); ^^^^^^^^^^^^^^^ /C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.20.0+1/lib/src/firebase_auth.dart:33:14: Error: Too many positional arguments: 0 allowed, but 2 found. Try removing the extra positional arguments. : super(app.name, 'plugins.flutter.io/firebase_auth'); ^ /C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.7.0/lib/src/firebase_app.dart:11:3: Error: 'FirebaseAppPlatform' isn't a type. FirebaseAppPlatform _delegate; ^^^^^^^^^^^^^^^^^^^ /C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.7.0/lib/src/firebase_app.dart:19:5: Error: The getter 'FirebaseAppPlatform' isn't defined for the class 'FirebaseApp'.
  • 'FirebaseApp' is from 'package:firebase_core/firebase_core.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.7.0/lib/firebase_core.dart'). Try correcting the name to the name of an existing getter, or defining a getter or field named 'FirebaseAppPlatform'. FirebaseAppPlatform.verifyExtends(_delegate); ^^^^^^^^^^^^^^^^^^^ /C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.7.0/lib/src/firebase.dart:16:10: Error: 'FirebasePlatform' isn't a type. static FirebasePlatform delegatePackingProperty; ^^^^^^^^^^^^^^^^ /C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.7.0/lib/src/firebase.dart:20:33: Error: Getter not found: 'FirebasePlatform'. delegatePackingProperty = FirebasePlatform.instance; ^^^^^^^^^^^^^^^^ /C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.7.0/lib/src/firebase.dart:41:27: Error: 'FirebaseOptions' isn't a type. {String /?/ name, FirebaseOptions /?/ options}) async { ^^^^^^^^^^^^^^^ /C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.7.0/lib/src/firebase.dart:43:5: Error: 'FirebaseAppPlatform' isn't a type. FirebaseAppPlatform app = ^^^^^^^^^^^^^^^^^^^ /C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.7.0/lib/src/firebase.dart:52:41: Error: Getter not found: 'defaultFirebaseAppName'. static FirebaseApp app([String name = defaultFirebaseAppName]) { ^^^^^^^^^^^^^^^^^^^^^^ /C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.7.0/lib/src/firebase.dart:53:5: Error: 'FirebaseAppPlatform' isn't a type. FirebaseAppPlatform app = _delegate.app(name); ^^^^^^^^^^^^^^^^^^^ /C:/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth_platform_interface-3.0.1/lib/src/firebase_auth_exception.dart:21:15: Error: No named parameter with the name 'plugin'. : super(plugin: 'firebase_auth', message: message, code: code); ^^^^^^

FAILURE: Build failed with an exception.

  • Where: Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 904

  • What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'.

Process 'command 'C:\flutter\bin\flutter.bat'' finished with non-zero exit value 1

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 2m 47s Exception: Gradle task assembleDebug failed with exit code 1

1 Answers1

0

Try a few things. Run

flutter clean

to clean your build. Then please check, whether the path to firebase actually exists, if you have a directory named "flutter" directly after C:\

Please provide more information about your firebase environment. Have you added the app to firebase already and added the package name, sha1... and so on?

Lars
  • 1,250
  • 9
  • 25
  • Yes the path does exist and i have added the package name to my firebase project and downloaded the json file and imported it to the app ... also i have initialized firebase in the main class but the error still showing up – Ateeg Razi Jan 23 '21 at 16:16