attach library
The half of Play a browser can run: a game somebody else started, attached to by its VM service address, with its console, the events it posts, its hot reload and restart, and a saved level sent to it.
No dart:io anywhere under it, which test/attach_web_test.dart
checks, since a web build compiles with dart:io in it and fails only
when it is called: the web editor imports this and not
flutter3d_editor_play.dart, whose FlutterRun starts a process a
browser does not have.
Classes
- AttachedRun
- A running game, attached to at vmService rather than started.
- GameEventLog
- The events a game posted, numbered as they arrive and capped at limit, dropping the oldest, the way the console is.
- PlayedGame
-
A game the editor plays: one it started with
flutter run --machine(FlutterRun) or one it attached to by its VM service (AttachedRun). - PlayIdle
- Not started yet: where every run is before its first PlayedGame.start.
- PlayRunning
- Running, with a VM service the editor can reach.
- PlayStarting
- Started and not yet running: the tool is building or the editor is attaching.
- PlayState
- Where a run is: not yet started, starting, running with a VM service to attach to, or over.
- PlayStopped
- Over: the game exited, the editor let go of it, or it never started.
- PostedEvent
-
One event a game posted with
flutter3d_game'spostToolEvent. - PostedEventPage
- What eventsSince answers: the events after a cursor, the cursor to ask with next, and what the cap or a new run took away.
- ScriptedPlayedGame
-
A PlayedGame a test drives: no
flutter run, no VM service, a game that starts, prints, posts and stops when the test says so. -
Watched<
T> - A value and the news of it changing, with no Flutter in it.
Functions
-
appendCapped<
T> (List< T> items, T item, int limit) → List<T> -
itemswithitemadded and the oldest dropped pastlimit. -
appendLine(
List< String> lines, String line, int limit) → List<String> -
The lines of the console a session keeps, with
lineadded and the oldest dropped pastlimit. -
connectVmService(
String uri) → Future< VmService> -
Connects to the VM service at
uri, in any of vmServiceWebSocket's spellings. -
describeLevelApplied(
Map< String, Object?> answer) → String - What the game said it did with a level, in a line for the status strip.
-
eventsSince(
List< PostedEvent> events, int since, {Set<String> ? kinds}) → PostedEventPage -
The events of
eventsafter the cursorsince, ofkindsonly when it is given, and the cursor to ask with next. -
levelApplyArguments(
String document) → Map< String, String> -
The parameters
ext.flutter3d.level.applytakes fordocument: the text as saved, and the digest of the level it parses to. -
levelPatchArguments(
String base, String document) → Map< String, String> ? -
The parameters
ext.flutter3d.level.patchtakes to turnbase, the level the game is believed to have, intodocument; null when the patch would be no shorter than the document, orbaseis not a level at all. -
pushLevel(
String vmService, String document, {String? base, ConnectVmService connect = connectVmService}) → Future< Map< String, Object?> > -
Sends
documentto the game whose VM service is atvmService, to the isolate that answersext.flutter3d.level.apply. -
vmServiceWebSocket(
String uri) → String -
The WebSocket address of a VM service, from whatever a person pasted: the
http://address a game prints on startup, thews://…/wsoneflutter run --machinereports, with or without a trailing slash.
Typedefs
-
ConnectVmService
= Future<
VmService> Function(String uri) - Connects to a VM service. A parameter of what attaches to a game, so a test hands it a service of its own making.