class ServiceListModel { final int id; final String service; final String icon; ServiceListModel({ required this.id, required this.service, required this.icon, }); factory ServiceListModel.fromJson(Map json) { return ServiceListModel( id: json['id'] ?? 0, service: json['service'] ?? '', icon: json['icon'] ?? '', ); } Map toJson() { return {'id': id, 'service': service, 'icon': icon}; } } class ServiceListResponse { final String status; final List data; ServiceListResponse({required this.status, required this.data}); factory ServiceListResponse.fromJson(Map json) { return ServiceListResponse( status: json['status'] ?? '', data: (json['data'] as List) .map((e) => ServiceListModel.fromJson(e)) .toList(), ); } Map toJson() { return {'status': status, 'data': data.map((e) => e.toJson()).toList()}; } }