unpackPayload method

dynamic unpackPayload()

Implementation

unpackPayload() {
  if (data == null) {
    return;
  }
  var encoding = metadata?['encoding'] ?? 'json';
  switch (encoding) {
    case 'json':
      if (data != null) {
        payload = jsonDecode(utf8.decode(base64Decode(data!)));
        return;
      }
    default:
      throw Exception("unexpected encoding $encoding");
  }
}