google_maps_flutter 而 运行 "flutter pub get" 的 Flutter 版本解决失败

Flutter version solving failed on google_maps_flutter while running "flutter pub get"

尽管我已将 google 地图包降级为 google_maps_flutter: ^0.5.33,即 <1.0.0,但 运行 flutter pub get 时我在输出中收到以下消息.

[proj_name] flutter pub get
Running "flutter pub get" in proj_name...                    
The current Flutter SDK version is 1.22.0-9.0.pre.

Because proj_name depends on google_maps_flutter >=1.0.0 which requires Flutter SDK version >=1.22.0 <2.0.0, version solving failed.
pub get failed (1; Because proj_name depends on google_maps_flutter >=1.0.0 which requires Flutter SDK version >=1.22.0 <2.0.0, version solving failed.)
exit code 1

pubspec.yaml

的代码片段
version: 1.0.0+1

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  google_maps_flutter: ^0.5.33

flutter --version

的结果
Flutter 1.22.0-9.0.pre • channel unknown • unknown source
Framework • revision 7a43175198 (3 months ago) • 2020-08-28 23:18:04 -0400
Engine • revision 07e2520d5d
Tools • Dart 2.10.0 (build 2.10.0-73.0.dev)

尝试删除 pubspec.yaml 声明中的 ^

google_maps_flutter: ^0.5.33google_maps_flutter: '0.5.33'

如果我没记错的话,^ 表示使用此版本或更高版本。

跟进步骤:

flutter channel stable

flutter upgrade

然后如果出现同样的错误再试一次

只需更改您的 pubspec.yaml file: google_maps_flutter: ^0.5.33 对此 google_maps_flutter:

它会自动工作,因为它会找出兼容的版本。

将 flutter 版本更新到 2.0.2 稳定版然后清理 运行 应用程序,这将解决问题