Targets · Dart · Project setup
Project setup
Everything around the rendered code that makes a working, runnable Flutter project.
Contents
How a Program becomes Dart, in parts. Start with the introduction, then follow each part into the rendered output and the runtime it links against.
- Introduction — what the Dart target is, and how to read the rest of this section.
- Capabilities — which high-level features are possible, built in or through a library.
- Example — a full program using every keyword, and the Dart it renders to.
- Naming considerations — how Program's dotted names are carried into Dart.
- Entry point — starting a program and mounting it as a Flutter app.
- Drivers — the native drivers that provide the interface, animation and network.
- Runtime — the Reactive and Context machinery the rendered code links against.
- Native modules — the hand-written Dart behind
NATIVEfunctions. - Keywords — how each of Program's keywords renders to Dart.
- Project setup — the files and commands to build and run the rendered program.
- Reserved words — the words Dart keeps for itself, and how a colliding name is escaped.
The files
A rendered Dart program is a Flutter package: a pubspec.yaml manifest and a
lib/ tree. Start one with flutter create, then drop the rendered code and
the runtime package in.
my_app/
pubspec.yaml # manifest: name, dependencies
lib/
reactive/ # the runtime package (Reactive + Context + drivers)
app.dart # the rendered program
main.dart # runApp(Program.Application(() { Main(); }, [ Ui.Flutter.Driver() ]))
# pubspec.yaml
name: my_app
environment:
sdk: '>=3.0.0 <4.0.0'
dependencies:
flutter:
sdk: flutter
reactive:
path: lib/reactive
Build and run
Fetch dependencies, then run on any attached device, simulator, desktop or the web:
flutter pub get
flutter run # a connected device or simulator
flutter run -d chrome # the web
flutter build apk # a release Android build (or ios / macos / windows)
The generated code and the runtime are ordinary Dart, so the whole project is exactly a normal Flutter app — nothing about it is special to build or ship.