getValue function

This method retrieves the value associated with the given key from the remote database It fetches the value using the provided key and converts it into an EventNotificationModel object If the value is found and successfully converted, the method returns the event data If any error occurs during the process, it returns null

Implementation

Future<EventNotificationModel?> getValue(String key) async {
  try {
    EventNotificationModel? event;
    var atKey = EventService().getAtKey(key);
    var atValue = await EventService().atClientManager.atClient.get(atKey);
    if (atValue.value != null) {
      event = EventNotificationModel.fromJson(jsonDecode(atValue.value));
    }

    return event;
  } catch (e) {
    print('$e');
    return null;
  }
}