Run commands upon installing Dart packages, and more.
It would be nice if all of these features were
eventually integrated into the main
Until then, this will do.
$ pub global activate scripts
To use packages that integrate with
scripts, you should run
scripts get instead of
pub get. This will run
pub get, and
then install package executables into a
Then, all installed packages will have their
get scripts run.
pub upgrade with
scripts upgrade. This will run
scripts as well.
You can run
scripts link to link executables into
It is very likely that you want to run your own scripts during
development, or upon package installation. Do as follows in your
name: foo # ... scripts: build: gcc -o foo src/foo.cc get: - dart_gyp configure - dart_gyp build
Installed dependencies with executables will automatically be
filled in to the
PATH during script execution.
Then, in your project root, you can run:
$ scripts build
.scripts-bin directory, if present.
This script simply runs
pub get, and then calls
npm init for Dart. This command will
run you through a series of prompts, after which a
will be generated for you.
Can be used to install dependencies without having to search the Pub directory for the current version.
# Install the newest version, and apply caret syntax $ scripts install my-package # Install a specific version $ scripts install my-package@^1.0.0 $ scripts install firstname.lastname@example.org+25 $ scripts install "my-package@>=2.0.0 <3.0.0" # Install a Git dependency $ scripts install my-package@git://path/to/repo.git # Specify a commit or ref $ scripts install my-package@git://path/to/repo.git#bleeding-edge # Install a local package $ scripts install my-package@path:/Users/john/Source/Dart/pkg # Install multiple packages $ scripts install my-package my-other-package yet-another-package # Install to dev_dependencies $ scripts install --dev http test my-package@git://repo#dev # Preview new `pubspec.yaml`, without actually installing dependencies, # or modifying the file. $ scripts install --dry-run my-experimental-package
Creates symlinks to each dependency (in future versions, I will eliminate symlink use), and also creates executable files linked to any dependencies that export executables.
clean, followed by
Add this to your package's pubspec.yaml file:
dependencies: scripts: "^1.0.0-dev"
You can install packages from the command line:
$ pub get
$ flutter packages get
Alternatively, your editor might support
pub get or
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
|1.0.0-dev||Nov 24, 2016|
We analyzed this package on Apr 23, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Detected platforms: Flutter, other
Changelog entries help clients to follow the progress in your code.
Package is pre-release.
Pre-release versions should be used with caution, their API may change in breaking ways.
The description is too short.
Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.
Fix analysis and formatting issues.
Analysis or formatting checks reported 7 hints.
Strong-mode analysis of
lib/src/commands/install.dartgave the following hint:
line: 2 col: 8
Unused import: 'package:args/args.dart'.
Strong-mode analysis of
lib/src/commands/link.dartgave the following hint:
line: 3 col: 8
Unused import: '../home.dart'.
Similar analysis of the following files failed:
Maintain an example.
Create a short demo in the
example/directory to show how to use this package. Common file name patterns include:
example.dartor you could also use