getEventDetails function

Future<EventNotificationModel?> getEventDetails(
  1. String key
)

Implementation

Future<EventNotificationModel?> getEventDetails(String key) async {
  EventNotificationModel eventData;
  String? regexKey;
  regexKey = await getRegexKeyFromKey(key);
  if (regexKey == null) {
    throw Exception('Event key not found');
  }
  try {
    var atkey = EventService().getAtKey(regexKey);
    var atvalue =
        await EventService().atClientInstance!.get(atkey).catchError((e) {
      print('error in get ${e.errorCode} ${e.errorMessage}');
      // ignore: invalid_return_type_for_catch_error
      return null;
    });
    eventData = EventNotificationModel.fromJson(jsonDecode(atvalue.value));
    return eventData;
  } catch (e) {
    return null;
  }
}