retrofit_generator 0.1.2 copy "retrofit_generator: ^0.1.2" to clipboard
retrofit_generator: ^0.1.2 copied to clipboard

outdated

retrofit generator is an dio client generator using source_gen and inspired by Chopper and Retrofit.

example/example.dart

import 'package:retrofit/http.dart';
import 'package:dio/dio.dart';

part 'example.retrofit.dart';

@RestApi(baseUrl: "https://httpbin.org/")
abstract class RestClient {
  static RestClient instance([Dio dio]) => _RestClient(dio);

  @GET("/get")
  @Headers({
    "Header-One": " header 1",
  })
  Future<Response<String>> ip(@Query('query1') String query,
      {@QueryMap() Map<String, dynamic> queryies,
      @Header("Header-Two") String header});

  @GET("/profile/{id}")
  Future<Response<String>> profile(@Path("id") String id,
      {@Query("role") String role = "user",
      @QueryMap() Map<String, dynamic> map = const {},
      @Body() Map<String, dynamic> map2});

  @POST("/post")
  @Headers({
    "Accept": "application/json",
  })
  Future<Response<String>> createProfile(@Query('query2') String query,
      {@QueryMap() Map<String, dynamic> queryies,
      @Header("Header-One") String header,
      @Body() Map<String, dynamic> map2,
      @Field() int field,
      @Field("field-g") String ffff});

  @PUT("/put")
  Future<Response<String>> updateProfile2(@Query('query3') String query,
      {@QueryMap() Map<String, dynamic> queryies,
      @Header("Header-One") String header,
      @Field() int field,
      @Field("field-g") String ffff});

  @PATCH("/patch")
  Future<Response<String>> updateProfile(@Query('query4') String query,
      {@QueryMap() Map<String, dynamic> queryies,
      @Field() int field,
      @Field("field-g") String ffff});
}
133
likes
0
pub points
98%
popularity

Publisher

verified publishermings.in

retrofit generator is an dio client generator using source_gen and inspired by Chopper and Retrofit.

Homepage

License

unknown (LICENSE)

Dependencies

built_collection, code_builder, dio, retrofit, source_gen, tuple

More

Packages that depend on retrofit_generator