chopper_generator 2.4.2

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

Changelog #

2.4.2 #

  • Fix on JsonConverter If content type header overrided using @Post(headers: {'content-type': '...'}) The converter won't add json header and won't apply json.encode if content type is not JSON

  • add bool override on applyHeader(s) functions, true by default

  • support List<MultipartFile>

2.4.1 #

  • Fix PartValue cast

2.4.0 #

  • Deprecate @FileField, use @PartFile instead
  • support chopper: ^2.4.1

2.3.4 #

fix trailing slash when empty path

2.3.3 #

  • update analyzer to 0.35.0

2.3.2 #

  • do not set to null explicitly

2.3.1 #

  • Fixed @Path issue, thanks to @kiruto
  • update built_collection to 4.0.0

2.3.0 #

2.2.0 #

  • Fix converter issue on List

    • Breaking Change on Converter.convertResponse<ResultType>(response), it take a new generic type => Converter.convertResponse<ResultType, ItemType>(response)
  • deprecated Chopper.service<Type>(Type), use Chopper.getservice<Type>() instead thanks to @MichaelDark

2.1.0 #

  • fix casting issue

2.0.0 #

  • Request is now containing baseUrl

  • Can call Request.toHttpRequest() direclty to get the http.BaseRequest will receive

  • If a full url is specified in the path (ex: @Get(path: 'https://...')), it won't be concaten with the baseUrl of the ChopperClient and the ChopperAPI

  • Add CurlInterceptor thanks @edwardaux

  • Add HttpLoggingInterceptor

  • Add FactoryConverter annotation @FactoryConverter(request: convertRequest, response: convertResponse)

  • BreakingChange

    • Method.url renamed to path
    • Converter.encode and Converter.decode removed, implement Converter.convertResponse and Converter.convertRequest` instead
    • ChopperClient.jsonApi deprecated, use a JsonConverter instead
    • ChopperClient.formUrlEncodedApi, use FormUrlEncodedConverter instead
    • remove JsonEncoded annotation, use FactoryConverter instead

1.1.0 #

  • BreakingChange Removed name parameter on ChopperApi New way to instanciate a service dart @ChopperApi() abstract class MyService extends ChopperService { static MyService create([ChopperClient client]) => _$MyService(client); }

1.0.1 #

  • update build package

1.0.0 #

  • Multipart request
  • form url encoded
  • add jsonAPI and formUrlEncodedApi boolean to ChopperClient
  • json and formUrlEncoding are now builtin
  • onError, onResponse, onRequest stream
  • error converter
  • add withClient constructor

0.1.0 #

  • update dart sdk

0.0.2 #

  • the generated extension is now *.chopper.dart

  • rename ServiceDefinition to ChopperApi

  • rename ChopperClient.services field to ChopperClient.apis

0.0.1 #

  • Initial version, created by Stagehand

Use this package as a library

1. Depend on it

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


dependencies:
  chopper_generator: ^2.4.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:chopper_generator/chopper_generator.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
77
Health:
Code health derived from static analysis. [more]
97
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
85
Learn more about scoring.

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

  • Dart: 2.4.0
  • pana: 0.12.19

Platforms

Detected platforms: other

Primary library: package:chopper_generator/chopper_generator.dart with components: io, build, 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. (-2.48 points)

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

line 359 col 11: Use isNotEmpty instead of length

line 372 col 17: Use = to separate a named parameter from its default value.

line 373 col 18: Use = to separate a named parameter from its default value.

line 374 col 20: Use = to separate a named parameter from its default value.

line 375 col 20: Use = to separate a named parameter from its default value.

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and chopper_generator.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.2 <3.0.0
analyzer >=0.35.0 <1.0.0 0.37.0
build ^1.0.0 1.1.5
built_collection ^4.0.0 4.2.2
chopper ^2.4.1 2.4.2
code_builder ^3.0.0 3.2.0
dart_style ^1.0.10 1.2.9
logging ^0.11.0 0.11.3+2
meta ^1.1.2 1.1.7
source_gen ^0.9.0 0.9.4+3
Transitive dependencies
args 1.5.2
async 2.3.0
built_value 6.7.0
charcode 1.1.2
collection 1.14.11
convert 2.1.1
crypto 2.0.6
csslib 0.16.1
fixnum 0.10.9
front_end 0.1.20
glob 1.1.7
html 0.14.0+2
http 0.12.0+2
http_parser 3.1.3
kernel 0.3.20
matcher 0.12.5
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
test ^1.3.0

Admin