world library
Worlds: several people on your real server, set up by a script.
Experimental. This library can change in any release while worlds are
being built, and a world opens only on macOS for now. The guide is
doc/worlds.md in flutterware's repository.
A world is one Dart file in the package that can start your server and
seed it — for a Dart server, the server's own — declared in
tool/flutterware.dart with WorldScript(...). Opening it runs the file
there: it brings the server up, makes fresh users through the
server's own API, and declares the Persons who use it, each with an app.
flutterware launches their apps — in the studio's embedded guest by
default — signed in as whoever the script made.
// server/tool/worlds/pickup_order.dart
import 'package:flutterware/world.dart';
/// A barista and a regular who has never used the app.
void main(List<String> args) => World.run(args, (w) async {
var server = await startServer(port: await w.freePort());
w.onClose(server.close);
// New every opening: the world's id, in the names the server gets.
var ana = await server.admin.createStaff('ana.${w.id}@example.com');
w.person(
'Ana',
email: ana.email,
app: Launch('Shop', knobs: {'server': '${server.url}', 'session': ana.token}),
on: Studio(Devices.iPad),
);
// A number your server accepts: its rule, so your helper.
w.person('Leo', phone: testPhone(w.id), app: Launch('Shop', knobs: {'server': '${server.url}'}));
});
Pure Dart: a server package can depend on it without Flutter in its
build, the bargain package:flutterware/server.dart already makes.
Classes
- ActionRun
- An action while it runs.
- Device
- One device an address may name.
- Devices
- The devices worth offering, which is not all of them.
- InboxMail
- A mail as MailInbox received it: its envelope, and what a person reading it would see.
- Launch
-
An app to start: one of the entry points the project declares for Run, by
its name, and the knobs its
mainis called with — by parameter name, as Run calls it. - MailInbox
-
A local SMTP server for a world: a service in the stack that sends its own
mail is pointed at it, and every mail that service sends is decoded and
handed to
onMail, the way a Dart server reports a mail it sends. - Person
- Someone using the system, as World.person declared them.
- Studio
- In the studio's embedded guest, drawn as device: no native build, a person's own storage without the app's help, and a platform the studio answers — notifications, links, preferences — so the world sees and plays it.
- World
- A world while its script runs: what the script declares, and the helpers that keep one opening from colliding with the next.
- WorldDevice
- Where a person's app runs.
Enums
- DeviceKind
- What silhouette to draw around a screen, if any.
- DevicePlatform
-
Ours rather than
TargetPlatform, which is Flutter-only. Translated at the one place a frame is drawn.