当我尝试在flutter网站的pubspec.yaml文件中添加依赖项时,尝试pub get
命令时出现错误:
[retgoo_internal] pub get
Resolving dependencies...
Because every version of aiframework depends on flutter any from sdk which is forbidden, aiframework is forbidden.
So, because retgoo_internal depends on aiframework ^1.0.7+12, version solving failed.
Flutter users should run `flutter packages get` instead of `pub get`.
和我的pubspec.yaml
name: retgoo_internal
description: An app built using Flutter for web
environment:
# You must be using Flutter >=1.5.0 or Dart >=2.3.0
sdk: '>=2.3.0 <3.0.0'
dependencies:
aiframework: ^1.0.7+12
flutter_web: any
flutter_web_ui: any
http: any
dev_dependencies:
build_runner: ^1.4.0
build_web_compilers: ^2.0.0
pedantic: ^1.0.0
dependency_overrides:
flutter_web:
git:
url: https://github.com/flutter/flutter_web
path: packages/flutter_web
flutter_web_ui:
git:
url: https://github.com/flutter/flutter_web
path: packages/flutter_web_ui
最佳答案
在flutter web中尚不支持此功能,例如某些软件包,但是解决此问题的唯一方法是通过从github获取软件包的源代码,将代码放入lib文件内的软件包中,然后将其放入您的项目中,然后通过更改路径来修复文件内可能发生的错误导入到:导入'package:flutter_web / material.dart';并且可能还需要进行一些更改。
它工作100%,所以很容易:)