B.1. Hosted packages and versioning with Pub

Each dependency hosted on the Pub website follows the same structure: title: version. There are special characters, like the ^, which describe a range of versions. The robust way to describe a version is by using comparison operators, such as

sdk: '>=2.0.0 <3.0.0'

This basically says, “Give me the newest version from 2.0.0 to 3.0.0, but not including 3.0.0.”

For Pub hosted packages, you can also use the caret (^) syntax to define a range. For example, path: ^1.4.1 is the same as saying, “Give me the newest version that is guaranteed to be backwards compatible to 1.4.1.”

Warning

If you’re using the > character in your pubspec, the line containing the > must be in quotes. Without quotes, it will be read as YAML syntax and break everything.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.134.78.106