Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dart 2.3 for, if and spread support warning message regarding versions

Tags:

flutter

dart

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

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?

like image 279
Sctajc Avatar asked May 12 '19 08:05

Sctajc


People also ask

What is the latest version of Dart?

February 3, 2022: 2.16 release.

What's new in Dart 2. 13?

It has new official images of Docker for Github. In this, Dart supports native interoperability. This new update of Dart supports FFI arrays and its structure for packaging, this update of Dart has also improved the readability of the code. This release supports short and good names in any complex types.

What is the spread operator in flutter?

The spread operator is a useful and quick syntax for adding items to arrays, and combining arrays. But today we will learn how we can use the spread operator (…) in UI Code to reduce lines of code. As you can see in the above code we have a column containing a Button and 5 little.


1 Answers

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

environment:   sdk: ">=2.3.0 <3.0.0" 
like image 110
flarkmarup Avatar answered Sep 20 '22 11:09

flarkmarup