start method

  1. @override
Future<void> start({
  1. required String bootstrapJs,
  2. required String mainJs,
  3. required ExtBridgeHandler bridges,
})

Bootstraps the engine: evaluates bootstrapJs (engine transport + shared core, see ext_bootstrap_js.dart) then mainJs (the extension source), and must resolve only after __extCommit() returned the registration payload. bridges dispatches the extension's jsr.ext.* host calls.

Implementation

@override
Future<void> start({
  required String bootstrapJs,
  required String mainJs,
  required ExtBridgeHandler bridges,
}) async {
  _checkStartable();
  _bridges = bridges;
  final script = await _writeScript(bootstrapJs, mainJs);
  final process = await _spawn(script);
  _process = process;
  _watch(process);

  try {
    _commit =
        await invoke(ExtJsGlobals.commit, const [], timeout: startTimeout)
            as Map<String, dynamic>;
  } on Object {
    await dispose();
    rethrow;
  }
}