chopper
chopper copied to clipboard
Type cast error when using FactoryConverter
Steps to Reproduce
Use FactoryConverter for a request with the specified response type.
Expected results: Correct behavior similar to global converter usage
Actual results:
type 'List
Code sample
@ChopperApi()
abstract class API extends ChopperService {
static API create() {
final client = ChopperClient(
baseUrl: Uri.parse(url),
converter: const JsonConverter(),
errorConverter: const JsonConverter(),
);
return _$AuthorTodayAPI(client);
}
@FactoryConverter(response: convertResponse)
@Get(path: path)
Future<Response<List<Map<String, dynamic>>>> fetch();
}
FutureOr<Response<T>> convertResponse<T>(Response res) =>
const JsonConverter().convertResponse(res);
Logs
type 'List<dynamic>' is not a subtype of type 'Response<List<Map<String, dynamic>>>' in type cast
No issues found!
Dart SDK version: 3.5.0 (stable) (Tue Jul 30 02:17:59 2024 -0700) on "windows_x64"