概要
コンソール、Web、Flutterアプリに対応したオンラインDartエディターです。
その他のプロジェクト計測したスター増加
- 24時間
- +1
- 7日間
- +5
- 15日間
- +3
- 1か月
- +4
期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。
README.md
オリジナルDartPad
DartPad is a free, open-source online editor to help developers learn about Dart and Flutter. You can access it at dartpad.dev.
DartPad edits and runs Dart and Flutter code in the browser, with analysis and compilation running locally in a WebWorker.
What's here?
The repository root is a Dart workspace with these packages:
| Package | Description |
|---|---|
| dartpad_frontend | The Jaspr web app served at dartpad.dev |
| dartpad_editor | Editor, language-server, and workspace building blocks |
| codemirror-dart | Dart wrapper around the CodeMirror 6 editor |
| codemirror-lang-dart | Dart language support for CodeMirror 6 |
| examples | Bundled examples, loaded with the sample= query parameter |
Link or embed
Project source
Choose one source per URL.
| Query | Source |
|---|---|
sample=<id> |
Bundled sample: counter, sunflower, fibonacci, flame-game, dart, or flutter |
gist=<id> |
GitHub Gist |
package=<name> |
Latest version of a pub.dev package |
package=<name>&version=<version> |
Exact pub.dev package version; version requires package |
url=<url> |
Tar archive, optionally gzip compressed; |
Project configuration
| Query | Effect | Default |
|---|---|---|
file=<path> |
Initial editor tab; repeat for multiple tabs in order, with the first active | The root README or resolved entrypoint |
root=<path> |
Directory for the file tree, analysis, and dependency resolution; root= selects the source root |
Common package root of explicit files and entrypoint, otherwise source root |
entrypoint=<path> |
File executed by Run, independent of the active tab | First initial Dart file with a top-level main, then <root>/lib/main.dart, then <root>/main.dart |
sdk=dart or sdk=flutter |
SDK kind; append :<version> to select an exact bundled version |
Inferred from the root pubspec or Gist imports; first available bundle of that kind |
mode=console or mode=flutter |
Execution mode; Flutter mode requires a Flutter SDK | Flutter with a Flutter SDK, except entrypoints under bin/, test/, or tool/; otherwise console |
- All paths are source-relative, including when
rootis set. For example,root=example&file=example/lib/main.dart. - Gists move root-level Dart files into
lib/; original paths such asfile=main.dart&entrypoint=main.dartstill work. - SDK versions must be available in the bundled SDK list.
Appearance and execution
| Query | Effect | Default |
|---|---|---|
embed=true |
Hide the app bar, footer, and file navigation; wait for Run before runtime startup | Standalone layout; Run the preview automatically |
panels=<panel-list> |
Initial panel configuration; + expands, - collapses in standalone mode or hides in embeds |
Inferred from context; see below |
theme=dark or theme=light |
Initial theme | Saved preference, otherwise system theme |
Panel configuration
The URL sets each panel's initial state, but these are interpreted as hints. Existing panel controls can change the layout afterwards. The app bar and status bar do not have their own reopening controls.
Use comma-separated panel names, each prefixed with + or -.
+ expands a panel. - collapses it in standalone mode and hides it in embeds.
The exception is -tabs, which hides tabs and breadcrumbs in both modes.
?embed=true&panels=+tabs,-filetree,-preview
| Panel | Standalone default | Embed default |
|---|---|---|
console |
Expanded | Collapsed |
problems |
Expanded (active) | Collapsed (active) |
preview |
Expanded | Expanded |
tabs |
Expanded | Hidden, unless multiple distinct file values are supplied |
filetree |
Expanded | Hidden |
statusbar |
Expanded | Hidden |
appbar |
Expanded | Hidden |
Tabs and breadcrumbs are shown together whenever multiple files are open, even
with -tabs, so users can switch between files. When only one file remains open,
they return to the configured visibility.
Bottom panel behavior
console and problems share the bottom area:
- The bottom area expands if either resolved tab is expanded, otherwise collapses if either is collapsed, otherwise hides. In embeds, hiding requires
-console,-problems. - The last positive hint (
+consoleor+problems) selects that tab. Without a positive hint, the more visible tab is selected (for example,-consolein standalone selects Problems). - In standalone mode, a single negative hint (
-consoleor-problems) keeps the area expanded and selects the other tab; both must be-to collapse the area.
Examples
<iframe
src="https://dartpad.dev/?sample=counter&embed=true&theme=light"
title="Flutter counter example"
width="100%"
height="600"
style="border: 0"
></iframe>
Develop locally
Requirements:
- Dart 3.12 or later.
- Jaspr CLI:
jaspr_cliis a dev dependency ofdartpad_frontend, sodart pub getinstalls it. Run it withdart run jaspr_cli:jaspr. Avoiddart pub global activate jaspr_cli; a global install ignores the Jaspr version pinned in the rootpubspec.yaml. - Chrome for tests.
From the repository root:
dart pub get
cd pkgs/dartpad_frontend
dart run tool/setup_sdk_assets.dart
cd ../examples
dart run build_examples.dart
cd ../dartpad_frontend
dart run jaspr_cli:jaspr serve -v
- Open http://localhost:8080/.
- SDK assets and example archives only need regenerating when missing or changed.
- See Development details for asset updates and CodeMirror builds.
Frontend checks and builds, from pkgs/dartpad_frontend:
| Task | Command |
|---|---|
| Check formatting | dart format --output=none --set-exit-if-changed lib test tool |
| Analyze | dart analyze --fatal-infos |
| Test in Chrome | dart test |
| Build | dart run jaspr_cli:jaspr build |
Further reading
| Document | Audience |
|---|---|
| Development details | Contributors updating generated assets |
| Startup design | Contributors working on project loading and execution |
| Frontend UI | Contributors working on the Jaspr UI |
| Editor package | Contributors working on editor and language-server integration |
| Examples | Contributors adding bundled samples |
| Sharing Guide | Users sharing DartPad links |
| Embedding Guide | Users embedding DartPad in their websites |
Background
DartPad began as an online playground for the Dart language built by the Dart tools team in 2015. It compiles, analyzes, and displays the results of its users' Dart code, and can be embedded in other websites as an iframe.
In Dec 2019, we launched a new version of DartPad (dartpad.dev) with a fresh new look-and-feel and support for the popular Flutter UI toolkit. To learn more about the new DartPad, please check this blog post. Interested in embedding DartPad in your websites? Check out this embedding guide.

Issues and bugs
Please file reports on the GitHub Issue Tracker.
License and Contributing
Contributions welcome! Please read this short guide first. You can view our license here.
関連プロジェクトを探す
読み込み中…