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
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.1Alternatives
Packages that do the same job and could replace chopper.
Works with
Packages commonly used together with chopper: ones it builds on, ones built on it, and its own family.
- loggingchopper depends on itProvides configurable logging with levels and stream listeners for Dart apps.
- equatablechopper depends on itProvides value‑based equality for Dart objects without manual == and hashCode.
- qs_dartchopper depends on itA query string encoding and decoding library for Dart ported from JavaScript's qs.
- chopper_generatorBuilt on chopperGenerates type‑safe Chopper client code from annotated service interfaces.
- chucker_flutterBuilt on chopperInspect HTTP(S) requests, responses, and network traffic with a built-in UI and local storage.
- pretty_chopper_loggerBuilt on chopperChopper interceptor that logs network calls in a pretty and readable format.
- simple_chopper_loggerBuilt on chopperRequest and response interceptor for Chopper that outputs readable logs.