fromJson static method

NotificationGroup? fromJson(
  1. Map<String, dynamic>? json
)

Implementation

static NotificationGroup? fromJson(Map<String, dynamic>? json) {
  if (json == null) {
    return null;
  }

  return NotificationGroup(
    id: (json['id'] as int?) ?? 0,
    type: NotificationGroupType.fromJson(
        json['type'] as Map<String, dynamic>?)!,
    chatId: (json['chat_id'] as int?) ?? 0,
    totalCount: (json['total_count'] as int?) ?? 0,
    notifications: List<Notification>.from(((json['notifications']
                as List<dynamic>?) ??
            <dynamic>[])
        .map((item) => Notification.fromJson(item as Map<String, dynamic>?))
        .toList()),
  );
}