mapUpdatedLocationDataToWidget method
Updates any KeyLocationModel data for updated data
Implementation
void mapUpdatedLocationDataToWidget(LocationNotificationModel locationData) {
String newLocationDataKeyId;
if (locationData.key!.contains(MixedConstants.SHARE_LOCATION)) {
newLocationDataKeyId =
locationData.key!.split('sharelocation-')[1].split('@')[0];
} else {
newLocationDataKeyId =
locationData.key!.split('requestlocation-')[1].split('@')[0];
}
for (var i = 0; i < allLocationNotifications.length; i++) {
if (allLocationNotifications[i].key!.contains(newLocationDataKeyId)) {
allLocationNotifications[i].locationNotificationModel = locationData;
}
}
notifyListeners();
// Update location sharing
if ((locationData.isSharing) && (locationData.isAccepted)) {
if (locationData.atsignCreator == currentAtSign) {
SendLocationNotification().addMember(locationData);
}
} else {
SendLocationNotification().removeMember(locationData.key);
}
}