Unpub is a package repository for Dart pub packages. It supports both publishing and serving packages. Unpub is similar to pub.dartlang.org, but it is designed to be used on a private network.
Plese make sure you have the following tools installed:
MongoDB installation through brew:
- Update Homebrew and add the MongoDB tap:
brew update
brew tap mongodb/brew
- Install MongoDB:
brew install mongodb-community
- Start MongoDB as a service:
brew services start mongodb/brew/mongodb-community
- Verify the installation by opening the MongoDB shell:
mongosh
- To stop MongoDB when you're done:
brew services stop mongodb/brew/mongodb-community
Start through VSC debug console OR via command: flutter pub run bin/unpub.dart
Access at http://localhost:4000
Serving at http://0.0.0.0:4000
- Build local unpub image:
docker build -f ./Dockerfile -t unpub-image .
- Add the image name into the docker-compose.yml file
version: "3.3"
services:
unpub:
image: <unpub image name>
container_name: unpub
- Run the container via:
docker compose up -d
- Access at http://localhost:4000
The detail of how to write a new package is in the Flutter package guide
- Create a new package folder in
packages
folder - Change directory into the new package folder
cd packagess
flutter create --template=package your_package_name
- Change directory into the package folder and run
flutter pub get
cd your_package_name
flutter pub get
Push the package to unpub server, you can push to your local server for testing as well
flutter pub publish --server http://0.0.0.0:4000