Application/medcify/lib/models/api/notification_response.dart
2022-09-26 12:03:52 +05:30

19 lines
573 B
Dart

import 'package:medcify/models/notification_item.dart';
class NotificationResponse{
bool? status;
String? message;
List<NotificationItem>? notifications;
NotificationResponse.fromJson(Map<String, dynamic> json){
status = (json["Code"] ?? "0") != "0";
notifications = (json["Data"] != null) ? json["Data"].map<NotificationItem>((e) => NotificationItem.fromJson(e)).toList() : [];
message = json["Message"] ?? "Something went wrong";
}
NotificationResponse.withError(String err){
status = false;
notifications = [];
message = err;
}
}