失败的断言:第 67 行 pos 16: 'map['projectId'] != null': 'projectId' 不能为 null

时间:2021-06-01 06:13:35

标签: firebase flutter dart

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

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): 

1 个答案:

答案 0 :(得分:0)

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