简体   繁体   English

如何修复 firebase 身份验证在 dart 应用程序中的 Z5ACEBC7CB7AB70DDACBBAE074B 文件中导入后出现的 firebase 错误?

[英]How to fix the firebase error I get after importing firebase auth in my dart file in flutter app?

I have been facing this error for weeks now, I simply can't use firebase anymore in my app.我已经面临这个错误好几个星期了,我根本无法在我的应用程序中使用 firebase 了。 I created a new application then added firebase as required.我创建了一个新应用程序,然后根据需要添加了 firebase。 Immediately I import firebase auth in my application I get a bunch of error.我立即在我的应用程序中导入 firebase auth 我收到一堆错误。 I've tired created several app and added firebase to it but still got this error.我已经厌倦了创建几个应用程序并添加了 firebase 但仍然出现此错误。 Followed tutorial to no avail按照教程无济于事

Here is my pubspec.yaml file这是我的 pubspec.yaml 文件

dependencies:
  flutter:
    sdk: flutter
  firebase_core: "^0.5.3"
  firebase_auth: "^0.18.4"
  cloud_firestore: "^0.14.4"

my dart file我的 dart 文件

import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';

class AuthService {
  static final _auth = FirebaseAuth.instance;
  static final _fireStore = FirebaseFirestore.instance;

  static Future<bool> signUp(String name, String email, String password) async {
    try {
      UserCredential authResult = await _auth.createUserWithEmailAndPassword(
          email: email, password: password);

      User signedInUser = authResult.user;

      if (signedInUser != null) {
        _fireStore.collection('users').doc(signedInUser.uid).set({
          'name': name,
          'email': email,
          'profilePicture': '',
          'coverImage': '',
          'bio': ''
        });
        return true;
      }

      return false;
    } catch (e) {
      print(e);
      return false;
    }
  }

}

Error message in run the error message is long and the same every time breaking it down beginning运行中的错误消息错误消息很长,每次将其分解开始时都相同

/C:/src/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.18.4+1/lib/firebase_auth.dart:10:8: Error: Error when reading '/C:/src/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth_platform_interface-2.1.4/lib/firebase_auth_platform_interface.dart': The system cannot find the path specified.

import 'package:firebase_auth_platform_interface/firebase_auth_platform_interface.dart';
       ^
/C:/src/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.18.4+1/lib/firebase_auth.dart:15:1: Error: Error when reading '/C:/src/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth_platform_interface-2.1.4/lib/firebase_auth_platform_interface.dart': The system cannot find the path specified.

export 'package:firebase_auth_platform_interface/firebase_auth_platform_interface.dart'
^
/C:/src/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.18.4+1/lib/src/firebase_auth.dart:15:3: Error: Type 'FirebaseAuthPlatform' not found.
  FirebaseAuthPlatform _delegatePackingProperty;
  ^^^^^^^^^^^^^^^^^^^^
/C:/src/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.18.4+1/lib/src/firebase_auth.dart:21:3: Error: Type 'FirebaseAuthPlatform' not found.
  FirebaseAuthPlatform get _delegate {
  ^^^^^^^^^^^^^^^^^^^^
/C:/src/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.18.4+1/lib/src/firebase_auth.dart:137:10: Error: Type 'ActionCodeInfo' not found.
  Future<ActionCodeInfo> checkActionCode(String code) {
         ^^^^^^^^^^^^^^

closing关闭

    RecaptchaVerifierOnExpired onExpired,
    ^^^^^^^^^^^^^^^^^^^^^^^^^^


FAILURE: Build failed with an exception.

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

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\src\flutter\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 5m 25s
Exception: Gradle task assembleDebug failed with exit code 1

After adding a new package must run flutter pub get in your terminal and restart your project.添加新的 package 后必须运行flutter pub get您的终端并重新启动您的项目。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 导入 firebase_auth 时出现此错误:URI 目标不存在:&#39;package:firebase_auth/firebase_auth.dart&#39; - I get this error importing firebase_auth: Target of URI doesn't exist: 'package:firebase_auth/firebase_auth.dart' firebase_auth.dart:18:67:错误:找不到成员,如何解决这个 flutter firebase 错误? - firebase_auth.dart:18:67: Error: Member not found, How to solve this flutter firebase error? 将 react-native-firebase/firestore 导入我的应用程序后,我收到构建错误“找不到 com.google.firebase:firebase-bom:21.3.0”。 - After importing react-native-firebase/firestore in to my app, I get the build error 'Could not find com.google.firebase:firebase-bom:21.3.0.' 在 app.js 中导入 firebase 后,我进行了初始化,但在控制器 firebase.auth.createUserWithEmailAndPassword 中不是函数 - After importing firebase in app.js I initialized but in controller firebase.auth.createUserWithEmailAndPassword is not a function NoSuchMethodError: Flutter Chat 应用程序中的“dart.global.firebase.auth” - NoSuchMethodError: 'dart.global.firebase.auth' in the Flutter Chat App 如何在颤振应用程序中获取 Firebase 安装身份验证令牌? - How to get firebase installation auth token in flutter app? 如何修复 Firebase Auth 仅在刷新后工作? - How do I fix Firebase Auth only working after refresh? 如何在一个扑动的应用程序中使用firebase phone auth - How to do firebase phone auth in a flutter app How do I use Firebase.dart with Firebase Emulators FireStore db in a Flutter Web app? - How do I use Firebase.dart with Firebase Emulators FireStore db in a Flutter Web app? 如何修复 Flutter Firebase 应用程序不退出错误 6904 - How to fix Flutter Firebase app doesn't exit error 6904
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM