dispatch method
Dispatch a verb invocation. Returns any JSON-serialisable value (or a Future thereof) — the bridge JSON-encodes and hands back to the JS Promise. Throw to reject the promise.
args is the list passed by JS (host.fs.read(path) → [path]).
Atoms validate arity / types and throw ArgumentError for schema
violations so the JS caller gets a clean error message.
Implementation
@override
Future<Object?> dispatch(String verb, List<Object?> args) async {
switch (verb) {
case 'current':
return <String, dynamic>{
'id': bundle.manifest.id,
'name': bundle.manifest.name,
'shortId': _shortId(bundle.manifest.id),
'version': bundle.manifest.version,
'directory': bundle.directory,
};
default:
throw ArgumentError('unknown verb: bundle.$verb');
}
}