【问题标题】:Failed assertion: line 67 pos 16: 'map['projectId'] != null': 'projectId' cannot be null断言失败:第 67 行 pos 16: 'map['projectId'] != null': 'projectId' cannot be null
【发布时间】:2021-06-01 06:13:35
【问题描述】:

突然我的应用开始显示以下错误:

E/flutter (16810): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: 'package:firebase_core_platform_interface/src/firebase_options.dart': Failed assertion: line 67 pos 16: 'map['projectId'] != null': 'projectId' cannot be null.
E/flutter (16810): #0      _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:46:39)
E/flutter (16810): #1      _AssertionError._throwNew (dart:core-patch/errors_patch.dart:36:5)
E/flutter (16810): #2      new FirebaseOptions.fromMap (package:firebase_core_platform_interface/src/firebase_options.dart:67:16)
E/flutter (16810): #3      MethodChannelFirebase._initializeFirebaseAppFromMap (package:firebase_core_platform_interface/src/method_channel/method_channel_firebase.dart:44:23)
E/flutter (16810): #4      ListMixin.forEach (dart:collection/list.dart:86:13)
E/flutter (16810): #5      MethodChannelFirebase._initializeCore (package:firebase_core_platform_interface/src/method_channel/method_channel_firebase.dart:34:10)
E/flutter (16810): <asynchronous suspension>
E/flutter (16810): #6      MethodChannelFirebase.initializeApp (package:firebase_core_platform_interface/src/method_channel/method_channel_firebase.dart:75:7)
E/flutter (16810): <asynchronous suspension>
E/flutter (16810): #7      Firebase.initializeApp (package:firebase_core/src/firebase.dart:44:9)
E/flutter (16810): <asynchronous suspension>
E/flutter (16810): #8      main (package:athomedoc/main.dart:10:3)
E/flutter (16810): <asynchronous suspension>
E/flutter (16810): 

【问题讨论】:

  • 请贴出此错误指向的代码相关部分。

标签: firebase flutter dart


【解决方案1】:

根据错误你得到projectId的空值,你可以在使用它之前打印/调试,以确保你从源获取数据。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-04-06
    • 2021-05-04
    • 2020-10-10
    • 2020-06-05
    • 2021-05-12
    • 1970-01-01
    • 2021-09-12
    相关资源
    最近更新 更多