on-internet
← Community

is there a way to automatically convert chopper response body to dart model object?

Stack Overflow ·

I have been manually converting chopper api response response.body and was wondering if its possible to automatically make a way to convert whatever type of response to whatever dart model object I have. Below are ways I want to do the conversion of an endpoint's response to a Dart model I have LoginResponse @ChopperApi() abstract class ApiService extends ChopperService { // @Post(path: '/login') Future<Response<LoginResponse>> login( @Body() body, ); } static ApiService create() { final client = ChopperClient( baseUrl: Environment.apiUrl, converter: const JsonConverter(), services: [ _$ApiSer

Comments

Sign in or sign up to comment and upvote.

No comments yet.