chopper2_generator 3.0.4

  • Readme
  • Changelog
  • Installing
  • 11

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

Changelog #

3.0.4 #

  • Maintenance release to match the version with generator

3.0.3 #

  • Fix a bug in generator not running

3.0.2 #

  • Maintenance release to match the version with chopper2

3.0.1 #

  • to change the name to chopper2_generator

3.0.0 #

  • Maintenance release to support last version of chopper2 package (3.0.0) that introduced a breaking change on error handling

2.5.0 #

  • Unsuccessful response are not throw anymore, use Response.isSuccessful getter or statusCode instead
  • Support HEAD request

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 chopper2: ^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 chopper2.service<Type>(Type), use chopper2.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 *.chopper2.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:
  chopper2_generator: ^3.0.4

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:chopper2_generator/chopper2_generator.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
2
Health:
Code health derived from static analysis. [more]
0
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
50
Overall:
Weighted score of the above. [more]
11
Learn more about scoring.

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

  • Dart: 2.5.1
  • pana: 0.12.21

Platforms

Detected platforms:

Error(s) prevent platform classification:

Error(s) in lib/generated/i18n.dart: Target of URI doesn't exist: 'package:flutter/foundation.dart'.

Health issues and suggestions

Fix lib/generated/i18n.dart. (-100 points)

Analysis of lib/generated/i18n.dart failed with 36 errors, 4 hints, including:

line 3 col 8: Target of URI doesn't exist: 'package:flutter/foundation.dart'.

line 4 col 8: Target of URI doesn't exist: 'package:flutter/material.dart'.

line 11 col 20: Classes and mixins can only implement classes.

line 11 col 20: Undefined class 'WidgetsLocalizations'.

line 19 col 15: Undefined class 'BuildContext'.

Document public APIs. (-1 points)

20 out of 20 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.

Maintenance issues and suggestions

Fix platform conflicts. (-20 points)

Error(s) prevent platform classification:

Error(s) in lib/generated/i18n.dart: Target of URI doesn't exist: 'package:flutter/foundation.dart'.

Homepage URL doesn't exist. (-20 points)

At the time of the analysis the homepage field https://github.com/lejard-h/chopper2 was unreachable.

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 chopper2_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.38.5
build ^1.0.0 1.2.0
built_collection ^4.0.0 4.2.2
chopper2 ^3.0.4 3.0.4
code_builder ^3.0.0 3.2.0
dart_style ^1.0.10 1.3.1
logging ^0.11.0 0.11.3+2
meta ^1.1.2 1.1.7
source_gen ^0.9.0 0.9.4+5
Transitive dependencies
args 1.5.2
async 2.4.0
built_value 6.7.1
charcode 1.1.2
collection 1.14.12
convert 2.1.1
crypto 2.1.3
csslib 0.16.1
fixnum 0.10.9
front_end 0.1.27
glob 1.1.7
html 0.14.0+3
http 0.12.0+2
http_parser 3.1.3
kernel 0.3.27
matcher 0.12.5
package_config 1.1.0
path 1.6.4
pub_semver 1.4.2
quiver 2.0.5
source_span 1.5.5
stack_trace 1.9.3
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
watcher 0.9.7+12
yaml 2.2.0
Dev dependencies
pedantic ^1.0.0 1.8.0+1
test ^1.3.0