getCode method

DmapCode getCode(
  1. Uint8List data
)

Get DAAP object DMAP code from data.

Get and return appropriate DMAP code object. Throws DmapDecodeException in case of unknown code.

Implementation

DmapCode getCode(Uint8List data) {
  var code = utf8.decode(data.sublist(0, 4)); // first 4 bytes is object code
  if (dmapCodeTypes.containsKey(code)) {
    return dmapCodeTypes[code]!;
  } else {
    throw DmapDecodeException(
        "'$code' was not found in actual DMAP codes list.");
  }
}