What does this mean in pubspec.yaml file of flutter?

Viewed 38

enter image description here

first, flutter`s version is 1.0, second, is this an SDK of dart?

3 Answers

Version is your app version, for example if user went to mobile setting they would see 1.0.0 in front of your app name.

Sdk is you refer to your dart sdk. for example if you are using a package, you can only use the one that have dart sdk between those number in screen shot.

If you want to see your flutter version run flutter doctor and you will see something like this:

[✓] Flutter (Channel stable, 3.0.4, on macOS 12.4 21F79 darwin-x64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.71.0)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

at first line you can find your flutter version, for example mine is channel stable, 3.0.4.

Version stands for when you going to upload your .apk/.ipa to store you can direct upgrade from here. sdk show your project sdk enviorment setup

Update version:A.B.C+X in pubspec.yaml.

For Android:

A.B.C represents the versionName such as 1.0.0.

X (the number after the +) represents the versionCode such as 1, 2, 3, etc.

For iOS:

A.B.C represents the CFBundleShortVersionString such as 1.0.0.

X (the number after the +) represents the CFBundleVersion such as 1, 2, 3, etc.

SDK Version

Pub tries to find the latest version of a package whose SDK constraint works with the version of the Dart SDK that you have installed.

As of Dart 2.12, omitting the SDK constraint is an error. When the pubspec has no SDK constraint, pub get fails with a message like the following:

pubspec.yaml has no lower-bound SDK constraint.
You should edit pubspec.yaml to contain an SDK constraint:

environment:
  sdk: '>=2.10.0 <3.0.0'
Related