Flutter遇到问题集合

Flutter遇到问题集合

运行flutter 项目,无法运行成功

问题1

Running "flutter packages get" in flutter_gallery...            

The current Dart SDK version is 2.1.0-dev.9.4.flutter-f9ebf21297.

Because flutter_gallery depends on test_core >=0.2.1 which requires SDK version >=2.1.0 <3.0.0, version solving failed.

解决:

方式一:升级到目前最新版本

进入到flutter sdk 位置,mac可以通过open -e .bash_profile

xxxx$ flutter channel master

Switching to flutter channel 'master'...

git: Switched to a new branch 'master'

git: Branch master set up to track remote branch master from origin.

xxxx$ flutter upgrade

xxxx$flutter doctor

方式二:通过git 切换到相应的版本

进入到flutter sdk 位置,mac可以通过open -e .bash_profile

 xxxx$git tag

xxxx$git checkout -b v1.5.8

删除flutter/bin/cache 内容

xxxx$flutter doctor

问题2

lib/widgets/image/cached_network_image.dart:463:31: Error: The argument type 'Null Function(StringBuffer)' can't be assigned to the parameter type 'Iterable Function()'.

 - 'StringBuffer' is from 'dart:core'.

 - 'Iterable' is from 'dart:core'.

 - 'DiagnosticsNode' is from 'package:flutter/src/foundation/diagnostics.dart' ('file:///Users/xxxx/Android/flutter/packages/flutter/lib/src/foundation/diagnostics.dart').

Try changing the type of the parameter, or casting the argument to 'Iterable Function()'.

        informationCollector: (StringBuffer information) {

.......

解决:

flutter 版本不匹配,但是找不到使用的flutter提供的方法或类,这里是由于自己的flutter sdk 版本号过高导致,可以进行降级,采用上面第二种方式就可以了

进入到flutter sdk 位置,mac可以通过open -e .bash_profile

 xxxx$git tag

xxxx$git checkout -b v1.5.8

删除flutter/bin/cache 内容

xxxx$flutter doctor

问题3

Because douban_app depends on flutter_test any from sdk which doesn't exist (the Flutter SDK is not available), version solving failed.

Flutter users should run `flutter packages get` instead of `pub get`.

解决:在terminal中输入flutter packages get

Flutter遇到问题集合_第1张图片

 

Flutter资源收集(持续更新):https://juejin.im/post/5ce75704f265da1ba77c7e53

你可能感兴趣的:(flutter)