ChannelMessages.fromMap constructor

ChannelMessages.fromMap(
  1. Map<String, dynamic>? json
)

Implementation

ChannelMessages.fromMap(Map<String, dynamic>? json) {
  if (json != null) {
    if (json['messages'] != null) {
      List<dynamic> jsonList = json['messages'].runtimeType == String //
          ? jsonDecode(json['messages'])
          : json['messages'];
      messages = jsonList
          .where((json) => json != null)
          .map((json) => Message.fromMap(json))
          .toList();
    } else {
      messages = null;
    }

    count = json['count'];
    offset = json['offset'];
    total = json['total'];
    success = json['success'];
  }
}