World class final
A world while its script runs: what the script declares, and the helpers that keep one opening from colliding with the next.
A world is set up, never reset. Every opening — the first and each restart — runs the script from the top, with a new id, so the emails, phone numbers and names it makes are new each time and the server needs no wiping between runs.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
This opening's id: six characters, new every time the world opens or
restarts. Fold it into the names, emails and phone numbers the script
makes —
'ana.\${w.id}@example.com'— and each opening's people are new. What a valid address or number looks like is the server's rule, so the script, which knows the server, writes them.final -
ready
→ Future<
void> -
Completes once every person's app is up.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
action(
String name, FutureOr< void> body(ActionRun run), {String? description}) → void -
Something anyone can do to the world while it is open — a human from
the studio, the agent through
worlds invoke. What it does isbody's; one that takes time says how far it is through ActionRun.progress, and stops when it is cancelled. -
freePort(
) → Future< int> - A port nothing on this machine is listening on — for a server the world hosts.
-
knob(
String name, {List< String> options = const [], String initial = '', String? description}) → String -
A value the world is opened with, and answers it: what it was opened or
restarted with, else
initial. Changing one restarts the world. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onClose(
FutureOr< void> close()) → void -
Runs
closewhen the world closes or restarts — the last registered first, as a stack unwinds. A failure is reported and the rest still run. -
person(
String name, {String? email, String? phone, String? userId, String? password, Launch? app, WorldDevice on = const Studio()}) → Person - Declares someone using the system, and answers them.
-
progress(
String message) → void - A line for whoever is watching the world open: Starting the server.
-
smtp(
String service, {int port = 0, InternetAddress? address, ({String host, int port})? relay}) → Future< MailInbox> - A local SMTP server for a service in the stack that sends its own mail and is not Dart — an identity provider mailing sign-up codes — so what it sends reaches its person like any mail a Dart server reports. Point the service's SMTP port at MailInbox.port; any username and password are accepted, and TLS is not offered.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
run(
List< String> args, FutureOr<void> body(World w)) → Future<void> -
Runs a world script's
bodyand serves whoever opened it, until they close the world. -
serve(
Stream< String> input, void output(String message), FutureOr<void> body(World w)) → Future<void> -
run, over
inputandoutputrather than the owner's socket — answers once the world has closed.