buildFromSerializedData static method

BaseChannel? buildFromSerializedData(
  1. Uint8List data
)

Implementation

static BaseChannel? buildFromSerializedData(Uint8List data) {
  final json = jsonDecode(String.fromCharCodes(data));
  if (json['channel_type'] == ChannelType.group.name) {
    return GroupChannel.fromJson(jsonDecode(String.fromCharCodes(data)));
  } else if (json['channel_type'] == ChannelType.open.name) {
    return OpenChannel.fromJson(jsonDecode(String.fromCharCodes(data)));
  } else if (json['channel_type'] == ChannelType.feed.name) {
    return FeedChannel.fromJson(jsonDecode(String.fromCharCodes(data)));
  }
  return null;
}