exec method

  1. @override
Future<LearningContentsDto> exec(
  1. String chapterId
)
override

Implementation

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

  try {
    final result = await client.getContentsGet(chapterId: chapterId);
    final contents = result.data?.map((e) => e).toList();

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

    final dto = ref.read(modelConvertManagerProvider).convertToContentsDto(
          contents: contents,
        );

    return dto;
  } on DioException catch (error, stackTrace) {
    throw handleDioError(error, stackTrace, chapterId);
  }
}