Flutter 依赖版本冲突

  • 报错:
Because path_provider 1.5.1 requires Flutter SDK version >=1.10.0 <2.0.0 and no versions of path_provider match >1.5.1 <2.0.0, path_provider ^1.5.1 is forbidden.

解决办法:
先将pubspec.yaml文件中的依赖后面的版本改成any

dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^0.1.2
  path_provider: any

然后flutter packages get拉包;
之后查看pubspec.lock文件中flutter自动拉去的不冲突的版本,将版本号复制到pubspec.yaml中。

 path_provider:
    dependency: "direct main"
    description:
      name: path_provider
      url: "https://pub.flutter-io.cn"
    source: hosted
    version: "1.5.0"

你可能感兴趣的:(Flutter)