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
Dart services pre-compiles .dill
files for the Dart SDK and Flutter Web SDK, which
are uploaded to Cloud Storage automatically. These files are located in the
artifacts/
directory.
If you need to re-generate these files, run the following command.
grind build-storage-artifacts
Or, if you don't have grind
on your PATH:
dart tool/grind.dart build-storage-artifacts
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
Or, if you don't have
grind
on your PATH:dart tool/grind.dart 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. Or, if you don't havegrind
on your PATH,dart tool/grind.dart update-pub-dependencies
-
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.