RoomMessages.fromMap constructor

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

Implementation

RoomMessages.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'];
  }
}