action method
Something anyone can do to the world while it is open — a human from
the studio, the agent through worlds invoke. What it does is body's;
one that takes time says how far it is through ActionRun.progress, and
stops when it is cancelled.
Each run is a step, as a tap on an app is — world.3 — and every HTTP
request body sends carries it, so the world traces what the action
caused through the servers and onto the phones. What body starts that
outlives it — a timer, a server — steps under it too: start those in
the world's body instead.
Implementation
void action(
String name,
FutureOr<void> Function(ActionRun run) body, {
String? description,
}) {
if (_actions.containsKey(name)) {
throw ArgumentError.value(name, 'name', 'Two actions have this name');
}
_actions[name] = body;
_send(WorldMessage.action, {'name': name, 'description': ?description});
}