release method Null safety

void release()

Implementation

void release() {
  if (!isHeld) {
    throw StateError('No lock to release');
  }
  _lock!.complete();
  _lock = null;
  _stack = null;
}