Open manabu0926 opened 1 month ago
e.g. want to generate, 〇〇_client.g.dart
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
if (_result.statusCode != 200) { ///← not success statusCode
throw DioException(
requestOptions: _options,
response: _result,
);
}
call function,
await api.postTalk.then(
(response) => state.value = response.data.todayShift,
onError: (Object error) => {
if (error is DioException)
{
print(error.response?.statusCode),
print(error.response?.data['message']),
},
},
);
Use case
when mutate request return error, I don't know how to handle errors.
I'm assuming that I want to process success in then, and process failure in onError. At that time, I would like to get the error message defined in the response.
Proposal
want to write, example,
Sorry if this has already been done. I would be happy if you could teach me how to write it! I think this will solve the redundant writing style that I was dissatisfied with with the previous openapi-generator, so I would be happy if you would consider it!