NyLive class
Exposes live commands to Metro while the app runs in debug or profile mode.
Nylo.init calls install, which registers every built-in command as a
Dart VM service extension (ext.nylo.<command>) on the main isolate and
streams route and log events on the nylo stream. Metro discovers the
running app through the Dart Tooling Daemon and calls these extensions.
Nothing is registered in release builds. Read-only commands also work in profile builds; commands that change the app are debug only.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
-
builtInCommands
→ List<
String> -
The names of every built-in command.
no setter
-
commandNames
→ List<
String> -
The names of the app-defined commands.
no setter
-
commands
→ Map<
String, LiveCommand Function()> -
The app-defined commands registered on the running Nylo instance.
no setter
- debugBuildOverride ↔ bool?
-
Overrides the debug-build check in tests.
getter/setter pair
- isDebugBuild → bool
-
Whether commands that change the app are allowed.
no setter
- isInstalled → bool
-
Whether the service extensions have been registered in this isolate.
no setter
-
onEmit
↔ void Function(String kind, Map<
String, Object?> data)? -
Receives every event passed to emit, in addition to the VM service.
getter/setter pair
-
seederNames
→ List<
String> -
The names of the registered seeders.
no setter
-
seeders
→ Map<
String, Seeder Function()> -
The seeders registered on the running Nylo instance.
no setter
Static Methods
-
decodeArgs(
String? raw) → Map< String, dynamic> -
Decodes the JSON-encoded
argsparameter of a service extension call. -
dispatch(
String command, [Map< String, dynamic> args = const {}]) → Future<Object?> -
Runs the built-in
commandwithargsand returns its JSON-safe result. -
emit(
String kind, Map< String, Object?> data) → void -
Posts a
nylo.<kind>event to thenyloVM service stream. -
handleExtension(
String command, Map< String, String> parameters) → Future<ServiceExtensionResponse> - Handles a service extension call from Metro.
-
install(
Nylo nylo) → void - Registers the service extensions, route observer and log listener.
Constants
- eventStream → const String
- The VM service stream route and log events are posted to.
- extensionPrefix → const String
- Prefix of every service extension Nylo registers.
- protocolVersion → const int
-
The protocol version reported by the
statuscommand. -
readOnlyCommands
→ const Set<
String> - Commands that only read app state, so they're allowed in profile builds.