writeBufferPart method

Future<void> writeBufferPart(
  1. Uint8List buffer,
  2. int start,
  3. int length
)

Implementation

Future<void> writeBufferPart(Uint8List buffer, int start, int length) {
  if (_closed) {
    throw StateError("Cannot write to socket, it is closed");
  }
  if (_writingBuffer != null) {
    throw StateError("Cannot write to socket, already writing");
  }
  _writingBuffer = buffer;
  _writeCompleter = Completer<void>();
  _writeOffset = start;
  _writeLength = length + start;

  _writeBuffer();

  return _writeCompleter.future;
}