# Manage Dart packages with Crawl

Although we’ve got tools like Stagehand to generate the boilerplate for a Dart project, a pain-point I’ve experienced regularly is managing Dart packages. Whenever I needed to add a new package, I usually followed the steps below:

1. Lookup package details on pub.dev
    
2. Hit the **Installing** tab and copy the latest version
    
3. Open my **pubspec.yaml** file in the Dart project
    
4. Add the package and version to `dependencies` or `dev_dependencies` list
    
5. Save file.
    
6. Run `pub get` to update my packages
    

Having programmed in Nodejs I was aware of the **npm** tool which provided the `init` and `install` commands to automate the creation and maintenance of packages.

After searching around I came across the Pubspec Assist extension for VS Code that enabled me to search and install a package through the UI. It works in most cases but I wasn’t content that I had to be in the editor in order to use it! So instead of complaining I decided I’ll write my own.

## **Introducing Crawl**

Crawl helps you manage Dart packages in your **pubspec.yaml** files. It borrows inspiration from the **npm** tool and will be familiar if you have used it.

The only pre-requisite is the [Dart](https://dart.dev/) runtime and you can install Crawl by running `pub global activate crawl`. This will enable the `crawl` executable in your terminal.

To launch the usage screen simply run `crawl` in your terminal:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1726186566577/161f15b7-19b4-4afc-8135-36047f6b0a3b.png align="center")

To create a new pubspec.yaml file enter `crawl init` in your terminal and follow the interactive prompt:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1726186589713/c565e37a-6f86-450f-86b2-56f62be5378e.png align="center")

To add a new package run the following command:

```bash
$ crawl install -p <package-name> # eg: `crawl install -p shelf`
$ crawl install -p <package-name> -v <version> # eg: `crawl install -p shelf -v 0.7.9`
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1726186614695/41c360ef-4295-40d2-a6e2-88f16306fcb6.png align="center")

To remove a package run the following command:

```bash
$ crawl uninstall <package-name>
```

This package is still early days, but currently you are able to:

1. Create a pubspec.yaml file
    
2. Add to `dependencies` including specifying a particular version
    
3. Add to `dev_dependencies` including specifying a particular version
    
4. Run `pub get` automatically to update project dependencies
    
5. Uninstall package
    
6. List unused dependencies in project
    
7. Lookup package information on Pub repository
    

Try it out and let me know what you think ? Although the Dart team will be introducing a `pub add` and `pub remove` command in the next release, this tool provides other commands that will be useful in your projects.

[Get the package](https://pub.dev/packages/crawl)
