convertJsonToEventModel method
void
convertJsonToEventModel()
Implementation
void convertJsonToEventModel() {
var tempRemoveEventArray = <EventKeyLocationModel>[];
for (var i = 0; i < allEventNotifications.length; i++) {
try {
// ignore: unrelated_type_equality_checks
if (allEventNotifications[i].atValue != 'null' &&
allEventNotifications[i].atValue != null) {
var event = EventNotificationModel.fromJson(
jsonDecode(allEventNotifications[i].atValue!.value));
// ignore: unnecessary_null_comparison
if (event != null && event.group!.members!.isNotEmpty) {
event.key = allEventNotifications[i].key;
allEventNotifications[i].eventNotificationModel = event;
}
} else {
tempRemoveEventArray.add(allEventNotifications[i]);
}
} catch (e) {
tempRemoveEventArray.add(allEventNotifications[i]);
}
}
allEventNotifications
.removeWhere((element) => tempRemoveEventArray.contains(element));
}