toMap method

Map<String, dynamic> toMap()

Implementation

Map<String, dynamic> toMap() {
  Map<String, dynamic> map = {};

  if (messages != null) {
    map['messages'] = messages
            ?.where((json) => json != null)
            ?.map((message) => message.toMap())
            ?.toList() ??
        [];
  }

  if (count != null) {
    map['count'] = count;
  }

  if (offset != null) {
    map['offset'] = offset;
  }

  if (total != null) {
    map['total'] = total;
  }

  if (success != null) {
    map['success'] = success;
  }

  return map;
}