Application/medcify/lib/models/api/notification_response.dart

19 lines
573 B
Dart
Raw Normal View History

2022-09-26 06:33:52 +00:00
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;
}
}