Flutter 2 backwards compatibility

Viewed 684

I'm struggling to find some information regarding Flutter and Dart versions and am hoping you can help me clear up some things.

  1. Is one version of Flutter always tied to one version of Dart? E.g. Flutter 1.27.0 uses only Dart 2.13.0? If not, how do i change my Dart version, or can i only change the range of Dart versions using the sdk field in the pubspec file?

  2. I have a pub package. It is currently for dart sdk versions >=2.7.0 <3.0.0 and I'd like to migrate it to null safety. For that i have to use at least dart sdk 2.12.0. After I migrate, does that mean that anyone using Flutter 1 and Dart versions lower than 2.12 won't be able to use the package?

Also, is there any statistic on percentages of usage per Flutter/Dart version? If I'm going to migrate to null safety I'd at least like to know that most users have already migrated and will be able to use my package.

2 Answers

Answering second question: Users of your package doesn't need to use 2.12 to use null safety packages.

  1. Framework provides a range of dart sdk version from minimum to maximum. This is because the team decides some new features and launch a new stable version and they also decide the maximum number till then they can provide fixes for that features or some old features.
  2. As flutter uses dart lang so it acquire all the features of dart. If dart changes/add features then flutter have to synchronized with dart version accordingly. Suppose you have changed dart sdk version to latest ;in flutter 1.xx range then the system suggest and throw warnings related to dart because flutter framework's library will miss some features and app can be crashed. Ex. If you try null safety then flutter will not recognize and if it recognize some how then compiler with throw issues related to Nullability
Related