unpack method Null safety

PackMeMessage? unpack(
  1. Uint8List data
)

Implementation

PackMeMessage? unpack(Uint8List data) {
	try {
		if (data.length < 4) return null;
		final int id = data.buffer.asByteData().getUint32(data.offsetInBytes, Endian.big);
		final PackMeMessage? message = _factory[id]?.call();
		message?._data = data;
		message?.$unpack();
		return message;
	}
	catch (err, stack) {
		onError?.call('Unpacking message failed: $err', stack);
		return null;
	}
}