retrofit_generator 0.2.2

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 79

See retrofit.dart

Changelog #

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 :

      @http.POST('/path/')
      @dio.Extra({'my_key':'my_value'})
      Future<Response<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: "https://httpbin.org/")
      abstract class RestClient {
          /// Forwarding constructor
          factory RestClient([Dio dio]) = _RestClient;
      }
    

0.1.0 #

  • fix health issues

0.0.1 #

  • init

example/example.dart

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

part 'example.g.dart';

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

  @GET("/get")
  @Headers({
    "Header-One": " header 1",
  })
  Future<Response<String>> ip(@Query('query1') String query,
      {@Queries() 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",
      @Queries() Map<String, dynamic> map = const {},
      @Body() Map<String, dynamic> map2});

  @POST("/post")
  @Headers({
    "Accept": "application/json",
  })
  Future<Response<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});

  @PUT("/put")
  Future<Response<String>> updateProfile2(@Query('query3') String query,
      {@Queries() 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,
      {@Queries() Map<String, dynamic> queryies,
      @Field() int field,
      @Field("field-g") String ffff});
}

Use this package as a library

1. Depend on it

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


dependencies:
  retrofit_generator: ^0.2.2

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';
  
Version Uploaded Documentation Archive
0.2.2 Jun 19, 2019 Go to the documentation of retrofit_generator 0.2.2 Download retrofit_generator 0.2.2 archive
0.2.1 May 27, 2019 Go to the documentation of retrofit_generator 0.2.1 Download retrofit_generator 0.2.1 archive
0.2.0 May 27, 2019 Go to the documentation of retrofit_generator 0.2.0 Download retrofit_generator 0.2.0 archive
0.1.2 May 5, 2019 Go to the documentation of retrofit_generator 0.1.2 Download retrofit_generator 0.1.2 archive
0.1.1 Apr 23, 2019 Go to the documentation of retrofit_generator 0.1.1 Download retrofit_generator 0.1.1 archive
0.1.0 Apr 11, 2019 Go to the documentation of retrofit_generator 0.1.0 Download retrofit_generator 0.1.0 archive
0.0.1 Apr 7, 2019 Go to the documentation of retrofit_generator 0.0.1 Download retrofit_generator 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
59
Health:
Code health derived from static analysis. [more]
98
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
79
Learn more about scoring.

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

  • Dart: 2.3.2
  • pana: 0.12.18

Platforms

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.

Fix lib/src/generator.dart. (-1 points)

Analysis of lib/src/generator.dart reported 2 hints:

line 286 col 12: The method '_getResponseType' isn't used.

line 290 col 12: The method '_getResponseInnerType' isn't used.

Dependencies

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.7
retrofit ^0.2.2 0.2.2
source_gen ^0.9.4+2 0.9.4+2
tuple ^1.0.2 1.0.2
Transitive dependencies
analyzer 0.36.3
args 1.5.2
async 2.2.0
build 1.1.4
built_value 6.6.0
charcode 1.1.2
collection 1.14.11
convert 2.1.1
cookie_jar 1.0.0
crypto 2.0.6
csslib 0.16.0
dart_style 1.2.8
fixnum 0.10.9
front_end 0.1.18
glob 1.1.7
html 0.14.0+2
kernel 0.3.18
logging 0.11.3+2
matcher 0.12.5
meta 1.1.7
package_config 1.0.5
path 1.6.2
pedantic 1.7.0
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+10
yaml 2.1.16
Dev dependencies
source_gen_test any
test any