toBinary method

List<int> toBinary({
  1. int offset = 0,
  2. int? length,
})

Convert to binary, with optional offset and length

Implementation

List<int> toBinary({int offset = 0, int? length}) {
  if(data == null) {
    throw AppwriteException('`data` is not defined.');
  }
  if(offset == 0 && length == null) {
    return data!;
  } else if (length == null) {
    return data!.sublist(offset);
  } else {
    return data!.sublist(offset, offset + length);
  }
}