read method Null safety

dynamic read(
  1. int targetType,
  2. Uint8List bytes

Tries to read targetType code using the current extension

  • targetType: The type code to read
  • bytes: The byte buffer to use to read the object

Returns null if the targetType is not supported by this extension


dynamic read(int targetType, Uint8List bytes) {
  if (targetType == type) {
    return doRead(MsgPackReader(bytes));

  return null;