close method Null safety

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

Closes the sink.

Calling this method more than once is allowed, but does nothing.

Neither add nor addError must be called after this method.

Implementation

@override
Future<void> close() {
  if (_addingStream) throw StateError('StreamSink is bound to a stream');
  return super.close();
}