Skip to content

dio

A Dart/Flutter library for making HTTP network requests with interceptors, uploads, downloads, and timeouts.

Stars
12.8k
Forks
1.6k
Licence
MIT
Language
Dart
Last update
11 days ago
Type
Library

What it is

Dio is an HTTP client package for the Dart and Flutter languages, used by app developers to send requests to web servers and receive responses. According to its description, it supports global settings, interceptors, form data, cancelling requests, file uploads and downloads, timeouts, and custom adapters. This repository is the base repo; the actual package lives in a subfolder with its own instructions.

  • Send GET and POST requests from a Flutter app to a REST API
  • Attach an interceptor to add authentication headers to every request
  • Upload a file using form data
  • Cancel an in-progress request when a user leaves a screen
  • Set a timeout so requests fail instead of hanging

Great for

  • Flutter app developers who need to call web APIs
  • Dart developers building server-side or command-line code that makes HTTP calls
  • Teams that want request interceptors or cancellable requests
  • Projects that need file upload or download handling over HTTP

Not ideal for

  • People who are not writing Dart or Flutter code, since this is a Dart package
  • Users looking for an end-user application; this repo is a developer library
  • Projects that need features beyond what the README lists, since this README does not detail the full API
Step-by-step guide: how to use dioInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Dart SDK or Flutter SDK

    Clone the repository (README gives no install command)

    git clone https://github.com/cfug/dio
  2. 2

    Run it

    • Open the dio package documentation at https://dio.pub
    • Add the dio package to your Dart or Flutter project's pubspec.yaml
    • Create a Dio instance and send a request to a URL
    • Read the response data in your code
  3. 3

    Get the most out of it

    • Read the Migration Guide before upgrading between major or minor versions
    • Use interceptors to share logic like authentication across requests
    • Add optional plugins such as cookie_manager or http2_adapter when you need them
    • Review the example_dart and example_flutter_app folders for working code

Downloads

Strengths

  • Covers common needs listed in the description: interceptors, timeouts, cancellation, uploads and downloads
  • MIT licensed and maintained by the Chinese Flutter User Group (cfug)
  • Has a large community following, with about 12,800 stars on GitHub

Trade-offs

  • Breaking changes can happen in major and minor versions, so the Migration Guide should be read before upgrading
  • The README is only an index; setup and usage details are in the linked package folders and at dio.pub

How it compares

ProjectStarsTypeLevelUpdatedBest for
dio (this)12.8kLibrarybeginner11 days agoFlutter app developers who need to call web APIs
getx11.2kLibrarybeginner5 days agoFlutter developers who want state management, routing and dependency injection from a single package
chi23kLibraryintermediate19 days agoGo developers building REST API services
bloc12.5kLibraryintermediate4 days agoFlutter developers who want to separate UI code from business logic
flame10.8kLibraryintermediate4 days agoFlutter developers who want to add a game to an app
echo32.8kLibraryintermediate6 days agoGo developers building REST APIs or backend services

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.