addDataToList method
Future
addDataToList(
- LocationNotificationModel locationNotificationModel, {
- String? receivedkey,
Adds new KeyLocationModel data for new received notification
Implementation
Future<dynamic> addDataToList(
LocationNotificationModel locationNotificationModel,
{String? receivedkey}) async {
/// so, that we don't add any expired event
if (isPastNotification(locationNotificationModel)) {
return;
}
/// with rSDK we can get previous notification, this will restrict us to add one notification twice
for (var _locationNotification in allLocationNotifications) {
if (_locationNotification.locationNotificationModel!.key ==
locationNotificationModel.key) {
return;
}
}
var tempHyridNotificationModel = KeyLocationModel();
tempHyridNotificationModel.locationNotificationModel =
locationNotificationModel;
allLocationNotifications.insert(0,
tempHyridNotificationModel); // last item to come in would be at the top of the list
if ((tempHyridNotificationModel.locationNotificationModel!.isSharing)) {
if (tempHyridNotificationModel.locationNotificationModel!.atsignCreator ==
currentAtSign) {
// ignore: unawaited_futures
SendLocationNotification().addMember(SendLocationNotification()
.locationNotificationModelToLocationDataModel(
tempHyridNotificationModel.locationNotificationModel!));
}
}
notifyListeners();
return tempHyridNotificationModel;
}