Like DartPad, but with a full IDE (Visual Studio Code, Cursor, or custom editor) and access to the entire pub.dev ecosystem.
codepad is a Mason brick created by Randal Schwartz to quickly scaffold Dart and Flutter playgrounds for testing code snippets and prototyping ideas.
Check out the demo video to see it in action.
- Dart / Flutter SDK installed and available in your
PATH. - Mason CLI: Install via Pub:
dart pub global activate mason_cli
- Editor: Visual Studio Code (
code), Cursor, or another editor launcher in yourPATH.
Install codepad globally from Brickhub:
mason add -g codepadTo install directly from the GitHub repository:
mason add -g codepad --git-url https://github.com/RandalSchwartz/mason-codepad.git --git-path codepadIf working within this repository, initialize the brick locally:
mason getAdd helper scripts to a directory in your PATH (e.g., ~/bin or /usr/local/bin):
Create executable script named dplay:
#!/bin/sh
exec mason make codepad -o "${2:-/tmp}" --dart=true --name="${1:-UUID}" --editor="${3:-${CODEPAD_EDITOR:-code}}" </dev/nullCreate executable script named fplay:
#!/bin/sh
exec mason make codepad -o "${2:-/tmp}" --dart=false --name="${1:-UUID}" --editor="${3:-${CODEPAD_EDITOR:-code}}" </dev/nullYou can set export CODEPAD_EDITOR=cursor in your shell profile (~/.zshrc / ~/.bashrc), and dplay and fplay will automatically default to opening your playgrounds in your preferred editor!
dplay— Spawns a new Dart playground in/tmp/<uuid>using$CODEPAD_EDITORorcode.fplay— Spawns a new Flutter playground in/tmp/<uuid>using$CODEPAD_EDITORorcode.dplay my_test— Spawns a Dart playground namedmy_testin/tmp/my_test.fplay my_widget ~/Projects cursor— Spawns a Flutter playground in~/Projects/my_widgetexplicitly opened withcursor.
.
├── mason.yaml # Mason configuration linking the local brick
├── analysis_options.yaml # Analyzer config excluding generated brick templates
├── pubspec.yaml # Root test suite manifest
├── test/ # Integration tests for brick generation
└── codepad/ # The Codepad Mason brick package
├── brick.yaml # Brick manifest and variable definitions (v0.17.0)
├── README.md # Brick-specific documentation
├── hooks/ # Pre-gen & post-gen lifecycle hooks (tested)
│ ├── pre_gen.dart # Auto-generates UUID names, checks CODEPAD_EDITOR, validates path
│ └── post_gen.dart # Runs pub get and launches configured editor
└── __brick__/ # Template files for generated Dart/Flutter projects
MIT