A server backend to support DartPad.
This project is a small, stateless Dart server, which powers the front-end of DartPad. It provides many of DartPad's features, including static analysis (errors and warnings), compilation to JavaScript, code completion, dartdoc information, code formatting, and quick fixes for issues.
The Flutter SDK needs to be downloaded and setup; check out https://flutter.dev/get-started.
To run the server, run:
$ dart bin/server.dart
The server will run from port 8080 and export several JSON APIs, like
/api/v3/analyze
and /api/v3/compile
.
To run tests:
dart test
To rebuild the shelf router, run:
dart run build_runner build --delete-conflicting-outputs
Package dependencies are pinned using the pub_dependencies_<CHANNEL>.yaml
files. To make changes to the list of supported packages, you need to verify
that the dependencies resolve and update the pinned versions specified in the
tool/dependencies
directory.
-
Edit the
lib/src/project_templates.dart
file to include changes to the whitelisted list of packages. -
Create the Dart and Flutter projects in the
project_templates/
directory:grind build-project-templates
-
Run
pub upgrade
in the Dart or Flutter project inproject_templates/
-
Run
grind update-pub-dependencies
to overwrite thetool/dependencies/pub_dependencies_<CHANNEL>.yaml
file for your current channel. -
Repeat the above steps for the latest version of each Flutter channel (
main
,beta
andstable
)
You can install and run a local redis cache. Run sudo apt-get install redis-server
to install on Ubuntu or brew install redis
for macOS.
See the Redis' Quick Start guide for other platforms.
To configure the server to use the local redis cache, run dart bin/server.dart
with the redis-url
flag.
Please report issues at https://github.com/dart-lang/dart-pad/issues.
Contributions welcome! Please read this short guide first. You can view our license here.