exec method

  1. @override
Future<ChaptersAndCompletionDto> exec()
override

Implementation

@override
Future<ChaptersAndCompletionDto> exec() async {
  final dio = ref.read(dioProvider);
  final client = LearningApi(dio, standardSerializers);

  try {
    final result = await client.getChaptersAndCompletionRatesGet();
    final chaptersAndCompletionRates = result.data;

    if (chaptersAndCompletionRates == null) {
      return throw Exception('chaptersAndCompletionRates is null');
    }

    final dto = ref
        .read(modelConvertManagerProvider)
        .convertToChaptersAndCompletionDto(
          chaptersAndCompletionRates: chaptersAndCompletionRates,
        );
    return dto;
  } on DioException catch (error, stackTrace) {
    throw handleDioError(error, stackTrace, null);
  }
}