isPng function
Returns true if bytes starts with the PNG file signature (89 50 4E 47 …).
Implementation
bool isPng(Uint8List bytes) {
if (bytes.length < 8) return false;
return bytes[0] == 0x89 &&
bytes[1] == 0x50 &&
bytes[2] == 0x4e &&
bytes[3] == 0x47 &&
bytes[4] == 0x0d &&
bytes[5] == 0x0a &&
bytes[6] == 0x1a &&
bytes[7] == 0x0a;
}