Dart 2.3 for,if和传播有关版本的支持警告消息 [英] Dart 2.3 for, if and spread support warning message regarding versions

查看:79
本文介绍了Dart 2.3 for,if和传播有关版本的支持警告消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到警告消息 直到2.2.2版才支持for,if和spread元素,但是需要此代码才能在较早版本上运行,但该代码

I am getting the warning message 'The for, if and spread elements were not supported until version 2.2.2, but this code is required to be able to run on earlier versions' but the code

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,
                    ),
              ),
            ],
  ),

可以正常工作。 minSDKVersion等为28。为什么它认为我希望能够在任何早期版本上运行此代码?我需要更改为更高版本吗?

works as expected. The minSDKVersion etc is 28. Why does it think I want to be able to run this code on any earlier version? What do I need to change to a later version?

推荐答案

pubspec.yaml 您可以更新您的环境sdk来消除这些警告:

In pubspec.yaml you can update your environment sdk to get rid of those warnings:

environment:
  sdk: ">=2.3.0 <3.0.0"

这篇关于Dart 2.3 for,if和传播有关版本的支持警告消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆