Flutter 2.8.1 使用 flutterfire - 根据文档,不需要使用 GoogleService-Info.plist 文件。该版本声明它支持直接 dart 初始化。在模拟器上工作正常,但是当在真实的 iOS 设备上运行时 - 从 Android Studio 或 XCode,我收到有关 plist 文件的错误。flutterfire configure 创建一个有效的 firebase_options.dart 文件,main 如下所示:
\nvoid main() async {\n WidgetsFlutterBinding.ensureInitialized();\n await Firebase.initializeApp(\n options: DefaultFirebaseOptions.currentPlatform,\n );\n\n runApp(const MyApp());\n}\nRun Code Online (Sandbox Code Playgroud)\nflutter doctor 的输出:
\nDoctor summary (to see all details, run flutter doctor -v):\n[\xe2\x9c\x93] Flutter (Channel stable, 2.8.1, on macOS 12.0.1 21A559 darwin-x64, locale en-US)\n[!] Android toolchain - develop for Android devices (Android SDK version 28.0.3)\n \xe2\x9c\x97 cmdline-tools component is missing\n …Run Code Online (Sandbox Code Playgroud)