Skip to content
pubscout

fetch_api

2.3.2, released 8 days ago by null.moe

Dart bindings for the JavaScript Fetch API, enabling web‑only HTTP requests with streaming and abort support.

WASM-ready
$ flutter pub add fetch_api
Source repository

What it does

Provides a Dart wrapper around the browser Fetch API, exposing full request options, AbortController cancellation, and response streaming as text, Blob or Uint8List streams. It also offers utilities to check streaming capability and handle redirects.

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

Use it when

  • You need fine‑grained control over fetch options on web platforms
  • You require streaming request or response bodies in a web app
  • You want to cancel in‑flight requests via AbortController

Skip it when

  • Running on mobile, desktop, or server where Fetch API isn’t available
  • You need a cross‑platform HTTP client with retries, interceptors, or advanced features

Strengths

  • Full coverage of Fetch API options
  • Supports request and response streaming
  • WASM‑ready and works with JavaScript interop

Weaknesses

  • Web‑only; no support for non‑web platforms
  • Limited higher‑level features like retries or interceptors
  • Breaking API changes between minor versions

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
1
import 'package:fetch_api/fetch_api.dart';

Future<void> main() async {
  final response = await fetch('https://example.com');
  final text = await response.text();
  print(text);
}

Alternatives

Packages that do the same job and could replace fetch_api.

  • http

    Cross‑platform HTTP client with a simple API and no web‑only constraints

  • dio

    Feature‑rich HTTP client with interceptors, retries, and support for all Flutter platforms

Works with

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