[英]Error when add Provider package in flutter app
In your package's pubspec.yaml add this line like below.在您的包的pubspec.yaml 中添加此行,如下所示。 Then run pub get/pub upgrade :然后运行pub get/pub upgrade :
dependencies:
provider: ^5.0.0
Note: Indentation must be considered.注意:必须考虑缩进。 Not valid无效
dependencies:
provider: ^5.0.0
This error is caused due to versioning error.此错误是由于版本控制错误引起的。
In your pubspec.yaml file在您的 pubspec.yaml 文件中
dependencies:
provider:
Leave the version blank, it will automatically select the best one according to the other packages.将版本留空,它将根据其他软件包自动 select 最好的一个。 After this run flutter pub get
之后运行flutter pub get
I solved it:) The name of your project can not be equal to package name.我解决了:)您的项目名称不能等于 package 名称。 The name of my project is provider and that is compiler gave an error.我的项目名称是提供者,即编译器出错。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.