我收到警告消息“ 直到版本2.2.2才支持for,if和spread元素,但是需要此代码才能在较早版本上运行 ”,但是该代码
Column( crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
if (document['propertyid'] == '1') Text('jjj'),
GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
PropertyDetails(document['propertyid'])));
},
child: Text(document['propertyname'],
style: TextStyle(
color: Colors.blue,
fontStyle: FontStyle.italic,
fontWeight: FontWeight
.w500) //Theme.of(context).textTheme.title,
),
),
],
),
Run Code Online (Sandbox Code Playgroud)
可以正常工作。minSDKVersion等为28。为什么它认为我希望能够在任何早期版本上运行此代码?我需要将什么更改为更高版本?
我在我的项目中运行了以下命令foo:
iDecode@iDecodes-Mac foo % pub get\nResolving dependencies... \nThe current Dart SDK version is 2.7.2.\n\nBecause foo requires SDK version >=2.12.0 <3.0.0, version solving failed.\niDecode@iDecodes-Mac foo % flutter --version\nFlutter 2.6.0-11.0.pre \xe2\x80\xa2 channel dev\nTools \xe2\x80\xa2 Dart 2.15.0 (build 2.15.0-116.0.dev)\nRun Code Online (Sandbox Code Playgroud)\n我的pubspec.yaml文件有:
environment:\n sdk: '>=2.12.0 <3.0.0'\nRun Code Online (Sandbox Code Playgroud)\n正如您所看到的,我当前的 Dart SDK 版本设置为2.7.2,我的项目的目标是 min 2.12.0,我的机器上安装的 Dart SDK 是2.15.0。那么,如何更改当前的 Dart SDK 版本呢?
这是我的~/.zshrc文件
export PATH=/flutter/bin:$PATH\nexport PATH=$PATH:/$HOME/Library/Android/sdk/platform-tools/\nexport PATH="$PATH:/$HOME/flutter/bin"\nexport PATH="$PATH":"$HOME/.pub-cache/bin"\nexport JAVA_HOME=$(/usr/libexec/java_home)\nRun Code Online (Sandbox Code Playgroud)\n 因为classbe依赖cupertino_icons >=1.0.1,需要SDK版本>=2.12.0-0 <3.0.0,版本解析失败。在 classbe 中运行“flutter pub get”... pub get failed (1; 因为 classbe 依赖于 cupertino_icons >=1.0.1 这需要 SDK 版本 >