stampOf static method

String? stampOf(
  1. Uint8List bytes
)

The stamp bytes were cooked with, or null (not a cooked model, or cooked without one). Reads only the header.

Implementation

static String? stampOf(Uint8List bytes) {
  if (!isCooked(bytes) || bytes.length < 12) return null;
  final view = ByteData.sublistView(bytes);
  final n = view.getUint32(8, Endian.little);
  if (12 + n > bytes.length) return null;
  try {
    final header = jsonDecode(
      utf8.decode(Uint8List.sublistView(bytes, 12, 12 + n)),
    );
    return header is Map ? header['stamp'] as String? : null;
  } on FormatException {
    return null;
  }
}