getRawData function Null safety

dynamic getRawData(
  1. List planes
)

Implementation

Uint8List getRawData(List<Plane> planes) {
  int totalBytes = 0;
  int offset = 0;

  for (int i = 0; i < planes.length; ++i) {
    totalBytes += planes[i].bytes.length;
  }

  Uint8List result = Uint8List(totalBytes);

  for (Plane plane in planes) {
    result.setAll(offset, plane.bytes);

    offset += plane.bytes.length;
  }

  return result;
}