forRequestLocation method
Implementation
void forRequestLocation(KeyLocationModel notification) async {
var atkeyMicrosecondId =
notification.key!.split('requestlocation-')[1].split('@')[0];
var acknowledgedKeyId = 'requestlocationacknowledged-$atkeyMicrosecondId';
var allRegexResponses =
await atClientInstance!.getKeys(regex: acknowledgedKeyId);
// ignore: unnecessary_null_comparison
if ((allRegexResponses != null) && (allRegexResponses.isNotEmpty)) {
var acknowledgedAtKey = getAtKey(allRegexResponses[0]);
var result = await atClientInstance!.get(acknowledgedAtKey).catchError(
// ignore: return_of_invalid_type_from_catch_error
(e) => print('error in get ${e.errorCode} ${e.errorMessage}'));
var acknowledgedEvent =
LocationNotificationModel.fromJson(jsonDecode(result.value));
// ignore: unawaited_futures
RequestLocationService()
.updateWithRequestLocationAcknowledge(acknowledgedEvent);
}
}