fetch_client
1.2.1, released 8 months ago by null.moe
HTTP client using Fetch API with WASM support, cancelable and streamable requests
What it does
Provides a drop‑in replacement for the http package that uses the Fetch API under the hood. It supports request cancellation, streaming responses, and WASM‑ready internals for web extensions.
AI-written summary of version 1.2.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- Web or Flutter web projects needing cancelable HTTP requests
- Applications that require streaming request bodies or responses
- Projects targeting Manifest V3 Chrome extensions
Skip it when
- Non‑web Dart or Flutter mobile projects
- Environments that do not support WASM or Fetch API
- Projects that already use a fully featured HTTP client like dio
Strengths
- Cancelable requests via Abortable
- Streaming support for responses and request bodies
- WASM‑ready for web extensions
- Access to redirect URLs and status codes
Weaknesses
- Only works on web (requires Dart 3.4+ and Chromium 105+ for streaming)
- Limited to Fetch API features, not a full HTTP client replacement
- Requires newer Dart SDK
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 2
import 'package:fetch_client/fetch_client.dart';
final client = FetchClient();
final response = await client.get(Uri.parse('https://example.com'));
print(response.body);Alternatives
Packages that do the same job and could replace fetch_client.
- cronet_http
An Android Flutter plugin providing access to the Cronet HTTP client.
87Compare - native_dio_adapter
A Dio HTTP client adapter that uses native platform HTTP stacks via cupertino_http and cronet_http.
87Compare - http2
An HTTP/2 implementation in Dart for low-level transport and pooled HTTP/2 requests.
91Compare - dio
A powerful HTTP networking package for Dart and Flutter with interceptors and request cancellation.
92Compare
Works with
Packages commonly used together with fetch_client: ones it builds on, ones built on it, and its own family.
- fetch_apifetch_client depends on itDart bindings for the JavaScript Fetch API, enabling web‑only HTTP requests with streaming and abort support.
- dart_openaiBuilt on fetch_clientUnofficial Dart and Flutter SDK for the OpenAI API and compatible providers.
- eventfluxBuilt on fetch_clientA Server-Sent Events client for Dart and Flutter with auto-reconnection.
- chat_gpt_sdkBuilt on fetch_clientA Dart and Flutter SDK for OpenAI APIs including GPT-4, GPT-5, o1, and assistants.