getApplication method

Future<Announcement?> getApplication({
  1. required String id,
  2. String? locale,
  3. GeneralCallback<Announcement>? callback,
})

Implementation

Future<Announcement?> getApplication({
  required String id,
  String? locale,
  GeneralCallback<Announcement>? callback,
}) async {
  try {
    final Response<Map<String, dynamic>> response = await dio.get(
      '/application/$id',
    );
    final Announcement data = Announcement.fromJson(response.data!);
    if (callback != null) {
      callback.onSuccess(data);
    }
    return data;
  } on DioException catch (dioException) {
    if (callback == null) {
      rethrow;
    } else {
      callback.onFailure(dioException);
    }
  }
  return null;
}