writeAll method

Future<bool> writeAll(
  1. List<int> data, {
  2. int timeoutMs = -1,
})

Implementation

Future<bool> writeAll(List<int> data, {int timeoutMs = -1}) async {
  final buf = Uint8List.fromList(data);
  var off = 0;
  while (off < buf.length) {
    final n = _inner.write(buf.sublist(off), timeout: timeoutMs);
    if (n <= 0) return false;
    off += n;
  }
  return true;
}