Skip to content
pubscout

chopper

8.7.1, released 7 weeks ago by hadrienlejard.io

An HTTP client generator for Dart and Flutter using source_gen.

Flutter FavoriteWASM-readyRock solid
$ flutter pub add chopper
Source repository

What it does

Chopper is an HTTP client generator inspired by Retrofit. It allows developers to define API services using annotations and generates the boilerplate implementation code using source_gen and build_runner.

AI-written summary of version 8.7.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want a Retrofit-style declarative HTTP client for REST or HTTP QUERY APIs in Dart or Flutter
  • You want code generation to handle request boilerplate and typing

Skip it when

  • You prefer an imperative HTTP client without code generation steps
  • You do not want to run build_runner in your development workflow

Strengths

  • Declarative API definitions using annotations
  • Built-in support for request converters and interceptors
  • Flutter favorite package

Weaknesses

  • Requires code generation via build_runner
  • Additional build step can slow down development cycles

Setup

Kind
Pure Dart
Effort
Medium
Code generation
Yes (build_runner)
Direct dependencies
5

Add chopper to dependencies, and build_runner and chopper_generator to dev_dependencies. Run build_runner to generate code.

dependencies:
  chopper: ^8.7.1

dev_dependencies:
  build_runner: ^2.4.0
  chopper_generator: ^8.7.1

Alternatives

Packages that do the same job and could replace chopper.

  • retrofit

    Alternative client generator for REST APIs with a similar Retrofit-inspired design.

  • dio

    Feature-rich imperative HTTP client for Dart and Flutter that does not require code generation.

Works with

Packages commonly used together with chopper: ones it builds on, ones built on it, and its own family.