import 'dart:convert'; import 'notification_model.dart'; NotificationResponse notificationResponseFromJson(String str) => NotificationResponse.fromJson(json.decode(str)); String notificationResponseToJson(NotificationResponse data) => json.encode(data.toJson()); class NotificationResponse { int? currentPage; List? result; int? totalItems; int? totalPages; NotificationResponse({ this.currentPage, this.result, this.totalItems, this.totalPages,}); NotificationResponse.fromJson(dynamic json) { currentPage = json['currentPage']; if (json['result'] != null) { result = []; json['result'].forEach((v) { result?.add(NotificationModel.fromJson(v)); }); } totalItems = json['totalItems']; totalPages = json['totalPages']; } Map toJson() { final map = {}; map['currentPage'] = currentPage; if (result != null) { map['result'] = result?.map((v) => v.toJson()).toList(); } map['totalItems'] = totalItems; map['totalPages'] = totalPages; return map; } }