I am currently developing a new app with Flutter version 1.14.6, Dart version 2.8.0, and I get the warning about the collection spread operator not being supported until version 2.3.0 when trying to use inline if-then conditions. As instructed here, I could just upgrade the minimum bound of my SDK versions in my pubspec.yaml to get rid of the warning:

environment:
  sdk: ">=2.1.0 <3.0.0"

to

environment:
  sdk: ">=2.3.0 <3.0.0"

My question is, since this is a brand-new app being written in a version well above 2.3.0, are there any disadvantages to raising that minimum SDK bound?


Solution 1: Abion47

The only time it might be a problem is if you are using a package or plugin that was written for an older version of Dart/Flutter and there is a significant and/or breaking change between then and now.

As an example, the File.readAsBytesSync method currently returns a Uint8List to signify that it is a list of bytes. Prior to Dart version 2.5.0, this method returned a List<int>, which could cause problems if a package written for 2.3 is expecting to get a List<int> and it gets a Uint8List instead.

(The above example is somewhat contrived since Uint8List inherits from List<int> so it probably wouldn't actually cause any problems. This is the only example I could come up with off the top of my head, though, and hopefully it gets the point across.)