retrofit_generator 0.3.0+1

See retrofit.dart

Changelog #

0.3.0 #

Added support for generic serilization.

Please note:

It doesn't support nested generics.

0.2.3 #

  • Added support for File form fields. See example in retrofit.dart readme.

0.2.2 #

  • bump to 0.2.2

0.2.1 #

  • Fixed pub upload issue

0.2.0 #

  • Added @Extra to pass extra options to dio requests, response, transformer and interceptors.

    Example :

      Future<String>> myMethod();
  • Fixed general dart style and code conventions

  • Automatically null check with ArgumentError.checkNotNull for required parameters

  • Now SuperClasses can use forwarding/redirecting constructors instead of static instance() method

    Example :

      @RestApi(baseUrl: "")
      abstract class RestClient {
          /// Forwarding constructor
          factory RestClient([Dio dio]) = _RestClient;

0.1.0 #

  • fix health issues

0.0.1 #

  • init


import 'dart:io';

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

part 'example.g.dart';

@RestApi(baseUrl: "")
abstract class RestClient {
  factory RestClient(Dio dio) = _RestClient;

    "Header-One": " header 1",
  Future<HttpGet> ip(@Query('query1') String query,
      {@Queries() Map<String, dynamic> queryies,
      @Header("Header-Two") String header});

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

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

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

  Future<String> updateProfile(@Query('query4') String query,
      {@Queries() Map<String, dynamic> queryies,
      @Field() int field,
      @Field("field-g") String ffff});

  Future<String> setProfile(@Field('image', 'my_profile_image.jpg') File image);

  /// This will add the image name from `image.path.split(Platform.pathSeperator).last`
  Future<String> setProfileImage(@Field() File image);

  /// This will automatically work too.
  Future<String> setProfileImageWithInfo(@Field() UploadFileInfo image);

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  retrofit_generator: ^0.3.0+1

2. Install it

You can install packages from the command line:

with pub:

$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:retrofit_generator/builder.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jul 22, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19


Detected platforms: other

Platform components identified in package: build, io, mirrors.

Health issues and suggestions

Document public APIs. (-1 points)

2 out of 2 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
built_collection ^4.2.0 4.2.2
code_builder ^3.2.0 3.2.0
dio ^2.1.0 2.1.13
retrofit ^0.3.0 0.3.0
source_gen ^0.9.4+2 0.9.4+3
tuple ^1.0.2 1.0.2
Transitive dependencies
analyzer 0.37.0
args 1.5.2
async 2.3.0
build 1.1.5
built_value 6.7.0
charcode 1.1.2
collection 1.14.11
convert 2.1.1
cookie_jar 1.0.1
crypto 2.0.6
csslib 0.16.1
dart_style 1.2.9
fixnum 0.10.9
front_end 0.1.20
glob 1.1.7
html 0.14.0+2
kernel 0.3.20
logging 0.11.3+2
matcher 0.12.5
meta 1.1.7
package_config 1.0.5
path 1.6.2
pedantic 1.8.0+1
pub_semver 1.4.2
quiver 2.0.3
source_span 1.5.5
stack_trace 1.9.3
string_scanner 1.0.4
term_glyph 1.1.0
typed_data 1.1.6
watcher 0.9.7+12
yaml 2.1.16
Dev dependencies
source_gen_test any
test any