read method Null safety

List read()

Implementation

List read() {
  p.offset = valueOffset!;
  final values = <dynamic>[];
  for (var i = 0; i < numValues; ++i) {
    switch (type) {
      case TYPE_BYTE:
      case TYPE_ASCII:
        values.add(p.readByte());
        break;
      case TYPE_SHORT:
        values.add(p.readUint16());
        break;
      case TYPE_LONG:
        values.add(p.readUint32());
        break;
      case TYPE_RATIONAL:
        final num = p.readUint32();
        final den = p.readUint32();
        if (den != 0) {
          values.add(num / den);
        }
        break;
      case TYPE_FLOAT:
        values.add(p.readFloat32());
        break;
      case TYPE_DOUBLE:
        values.add(p.readFloat64());
        break;
    }
  }
  return values;
}