dartrofit_converter_json 1.0.0 dartrofit_converter_json: ^1.0.0 copied to clipboard
The Json support for dartrofit.
Dartrofit_converter_json for dartrofit #
The Json support for dartrofit
First, depend on it
dependencies:
dartrofit_converter_json: latest version
Then, add it to Dartrofit
configuration
final dartrofit = Dartrofit(Uri.parse('http://0.0.0.0:7777/'))
..converterFactories.add(JsonConverterFactory());
Usage #
All types accepted by jsonEncode()
in json
can be annotated with @Body()
.
@WebApi()
abstract class Api {
Api._();
factory Api(Dartrofit dartrofit) = _$Api;
@POST('books/v1/postBooks')
Future<Response<Map<String, dynamic>>> postBookNumber(@Body() Map<String, dynamic> body);
}