decodeShareCode function
Decodes a share code (plain or steered), or null when it is malformed, fails its CRC, or is a steered format this build does not know (see shareCodeStatus). Callers must still check the family id and that SharePayload.engineVersion is not newer than the app's ("update the app to open this theme").
Implementation
SharePayload? decodeShareCode(String input) {
final s = normalizeShareCode(input);
if (s == null) return null;
final bits = _bitsOf(s);
if (s.length == _longLength) return _decodeSteered(bits);
if (crc7(bits.sublist(0, 43)) != _readBits(bits, 43, 7)) return null;
return SharePayload(
familyId: _readBits(bits, 0, 5),
engineVersion: _readBits(bits, 5, 6),
seed: _readBits(bits, 11, 32),
);
}