dispose method

Future<void> dispose()

Rejects new operations, waits for accepted ones, then disposes a retained encoder. Later calls return the same future.

Implementation

Future<void> dispose() => _closing ??= () async {
  _cancelIdleRelease();
  await _pending;
  _cancelIdleRelease();
  _cachedSavedIndexes.clear();
  final retained = _retained;
  _retained = null;
  if (retained != null) _evict(retained);
  await Future.wait(_disposals.toList());
}();