SsDevChannel class

The in-app end of the SpriteStudio dev push channel.

It registers a dart:developer service extension — ext.ssgen.reload — that an external host tool (dart run ssgen_flutter:sswatch) calls over the VM Service after it reconverts an edited SpriteStudio_Source project. The call carries the fresh pack to the running app, which hot-swaps it via SpriteStudioPlayer.reload with the playhead preserved.

Two kinds of player take a push. Every player that loaded its pack with SpriteStudioPlayer.loadAsset — so every SpriteStudioAnimation — joins by itself, since the asset key already names the pack and its folder. A SsLiveReloadTarget joins by register, for a player the key cannot describe or a screen that wants to hear about the reload; where one names a player that also joined by itself, the target is the one used.

It does not ride Flutter's own hot reload:

  • it needs no r — the host tool triggers it directly, and
  • it works while the app runs under an IDE debugger (the tool does not own flutter run), on desktop and device alike.

Debug-only by construction: the VM Service (hence any extension) is absent in release, so registration is skipped there. It DOES register on the web in debug (flutter run -d chrome, where DWDS routes the extension call), where a push carries bytes since there is no host filesystem to read a file push from. The extension is registered lazily on the first register or registerAsset; further registrants just join.

ext.ssgen.reload protocol (all params are strings)

param meaning
source file (desktop: read from disk) or bytes (device/web: base64). Defaults to file when dir is present, else bytes.
dir absolute host output dir (a file push reads <dir>/<pack>.ssab).
pack a specific pack stem (a bytes push targets exactly this pack).
bytes base64 .ssab (a bytes push).

A file push reloads every enabled target whose current pack exists in dir — so the app reloads exactly what it is showing, and a reconvert that touched other packs is a no-op for it. Result: {"ok":bool, "reloaded":int, "animations":int?, "errors":[String]?} — errors names each target whose reload threw, so the host can say why a push reloaded nothing.

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

handleReload(Map<String, String> params) → Future<Map<String, Object?>>
Applies one ext.ssgen.reload call and returns its result, the body of the service extension.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
register(SsLiveReloadTarget target) → void
Registers target and, on the first call, wires up extensionMethod. Safe to call from State.initState — the target's getters are only read when a push arrives. Debug-only: a no-op in profile/release; on the web it registers in debug (flutter run -d chrome, via DWDS).
registerAsset(SpriteStudioPlayer player, String assetKey) → void
Joins player as the pack it loaded from assetKey — what SpriteStudioPlayer.loadAsset does in a live-reload build. An app does not call this.
toString() → String
A string representation of this object.
inherited
unregister(SsLiveReloadTarget target) → void
Removes target (e.g. from State.dispose). The extension itself stays registered — there is no unregister API and it is an inert no-op with no targets.
unregisterAsset(SpriteStudioPlayer player) → void
Takes player back out — on its dispose, or when it loads bytes that no asset key describes.

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

instance → SsDevChannel
The process-wide channel.
final

Constants

extensionMethod → const String
The service-extension method name the host tool calls (shared with sswatch via ssReloadExtensionMethod so the two can't drift).