close method

Future<void> close()

Deletes the engine; waits for a call in flight inside the runtime. A call still queued on the page lock is refused when its turn comes.

Implementation

Future<void> close() async {
  if (_state == _EmbedderState.closed) return;
  _state = _EmbedderState.closed;
  final engine = _engine;
  _engine = null;
  // Waits for a call in flight inside the runtime (its own mutex): the
  // load's probe may be one.
  if (engine != null) await engine.delete();
}