NotificationResponseMessage constructor

NotificationResponseMessage(
  1. Uint8List bytes,
  2. Encoding encoding
)

Implementation

factory NotificationResponseMessage(Uint8List bytes, Encoding encoding) {
  final view = ByteData.view(bytes.buffer, bytes.offsetInBytes);
  final processID = view.getUint32(0);
  final first0 = bytes.indexOf(0, 4);
  final channel = encoding.decode(bytes.sublist(4, first0));
  final payload =
      encoding.decode(bytes.sublist(first0 + 1, bytes.lastIndexOf(0)));
  return NotificationResponseMessage._(processID, channel, payload);
}