Dart packages

Dart provides reusable code as packages, that is shared by other applications.

It provides package manager tools (pub) to manage the packages, use in your dart applications.

Dart packages contain classes and functions.

Install packages in Dart

To use a package in other applications, first define the dependency in pubspec.yaml.

  package: version

pub package manager

pub is a package manager for Dart and Flutter

Update package

If there is any changes to package, will release a new version, publish it.

Once new version is updated to pubspec.yaml, You can upgrade to new version

  • calling pub get command in terminal, It updates pubspec.lock file, install the latest version of package.
  • Another way, calling pub upgrade command: It updates most stable version,