当我遵循 the docs 并添加配置时,我将国际化添加到我的 Flutter 应用程序中:
generate: true
显示此错误:
Unexpected child "generate" found under "flutter".
Exception: Please correct the pubspec.yaml file at ./pubspec.yaml
Error detected in pubspec.yaml:
我从互联网上搜索并告诉我切换到主频道可以解决这个问题。但我想保持稳定的频道,还有其他方法可以解决这个问题吗?是否可以保持稳定的渠道并避免此问题?这是颤振环境信息:
$ ~/apps/flutter/bin/flutter doctor -v
[✓] Flutter (Channel stable, 1.20.4, on Mac OS X 10.15.7 19H114, locale en-CN)
• Flutter version 1.20.4 at /Users/dolphin/apps/flutter
• Framework revision fba99f6cf9 (4 months ago), 2020-09-14 15:32:52 -0700
• Engine revision d1bc06f032
• Dart version 2.9.2
• Pub download mirror https://pub.flutter-io.cn
• Flutter download mirror https://storage.flutter-io.cn
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /Users/dolphin/Library/Android/sdk
• Platform android-30, build-tools 30.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 12.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.3, Build version 12C33
• CocoaPods version 1.10.0
[!] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
[!] IntelliJ IDEA Community Edition (version 2020.3.1)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• For information about installing plugins, see
https://flutter.dev/intellij-setup/#installing-the-plugins
[!] IntelliJ IDEA Ultimate Edition (version 2019.2.2)
• IntelliJ at /Users/dolphin/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• For information about installing plugins, see
https://flutter.dev/intellij-setup/#installing-the-plugins
[✓] VS Code (version 1.52.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.18.1
[✓] Connected device (1 available)
• iPhone 11 Pro (mobile) • 4FEAF225-103D-4237-96D7-026059D2BDB4 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-7
(simulator)
! Doctor found issues in 3 categories.
(base)
答案 0 :(得分:2)
您使用的是 Flutter 1.20.4 版,但 generate
键是在 1.22 版中添加的。更新到最新的稳定版本。
[flutter_tools] generate a synthetic flutter_gen package on pub get #61261