Flutter 2.8.1使用flutterfire - 根据文档,不需要使用GoogleService-Info.plist文件。此版本支持直接dart初始化。在模拟器上可以正常工作,但在真实的iOS设备上运行时 - 无论是从Android Studio还是XCode中运行,都会出现有关plist文件的错误。flutterfire configure创建有效的firebase_options.dart文件,主要如下:
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
runApp(const MyApp());
}
flutter doctor的输出结果:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.8.1, on macOS 12.0.1 21A559 darwin-x64, locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
✗ cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] VS Code (version 1.63.2)
[✓] Connected device (3 available)