close method

  1. @override
Future<void> close()
override

Implementation

@override
Future<void> close() => _closing ??= Future<void>(() async {
      for (final call in List.of(_calls)) {
        await call.close();
      }
      while (true) {
        final status = _instance.destroy();
        if (status == 0) {
          _closed = true;
          _turn.complete();
          return;
        }
        if (status != 3) {
          throw RpcError(13, 'Module teardown failed ($status)');
        }
        await _nextTurn();
      }
    });