A production-ready Dart client library for the IPFS HTTP API, built with Chopper and fully migrated to Dart 3 + Null Safety.
Originally forked from hackyguru/IPFS-Flutter and upgraded to modern Dart/Flutter standards.
IPFS (InterPlanetary File System) is a decentralized, peer-to-peer protocol for storing and sharing data. This library acts as a Dart HTTP client that lets you interact with a locally running IPFS node directly from your Dart or Flutter application — without any platform-specific native code.
You can:
- Add any data (text, bytes) to IPFS and get back a unique content hash (CID)
- Retrieve any data from IPFS using its CID
- Integrate IPFS into any Dart or Flutter project with just a few lines of code
- Add data to IPFS — upload bytes/strings and receive a content identifier (CID/hash)
- Read data from IPFS — fetch content by its hash using the
/api/v0/catendpoint - Type-safe responses — strongly typed
AddandCatresponse models - Full Dart 3 Null Safety — no nullable surprises at runtime
- Chopper HTTP client — auto-generated, interceptor-based HTTP layer
- JSON serialization — powered by
json_annotation+json_serializable - Zero platform code — works on any Dart/Flutter target (mobile, web, desktop, CLI)
This project was fully modernized from its original 2021 state:
| Area | Before | After |
|---|---|---|
| Flutter | Not installed | 3.44.2 (latest stable) |
| Dart SDK | >=2.10.0 <3.0.0 |
>=3.8.0 <4.0.0 |
| Null Safety | Pre-null-safety | Full Dart 3 Null Safety |
chopper |
3.0.6 | 8.6.0 (+5 major versions) |
chopper_generator |
3.0.6 | 8.6.1 |
json_annotation |
3.1.0 | 4.12.0 |
json_serializable |
3.3.0 | 6.14.0 |
build_runner |
1.0.0 | 2.4.0 |
logging |
0.11.4 | 1.3.0 |
test |
1.14.4 | 1.25.0 |
| Lint package | pedantic (deprecated) |
lints 5.0 |
Code-level changes:
- Migrated all models (
Add,Cat) to null-safe fields with? - Updated
ChopperClient.baseUrlfromString→Uri - Replaced deprecated
@Post→@POST,@multipart→@Multipart() - Moved
json_serializablefromdependencies→dev_dependencies(bug fix) - Regenerated all
.g.dartand.chopper.dartfiles for compatibility dart analyze→ No issues found
- Flutter 3.44.2+ / Dart 3.8+
- IPFS (Kubo) daemon running locally
brew install --cask flutter
flutter --versionbrew install ipfs
ipfs init
ipfs daemonKeep the daemon running in a terminal. You'll see Daemon is ready when it's up.
git clone https://github.com/Vanisha1606/IPFS-Flutter.git
cd IPFS-Flutterdart pub getdart run build_runner buildimport 'package:dart_ipfs_client/dart_ipfs_client.dart';final ipfs = Ipfs(url: 'http://127.0.0.1:5001');import 'dart:convert';
final addRes = await ipfs.add(utf8.encode('Hello World!'));
print(addRes.body?.toJson());
// {Bytes: null, Hash: Qmf1rtki74jvYmGeqaaV51hzeiaa6DyWc98fzDiuPatzyy, Name: ..., Size: 20}final catRes = await ipfs.cat(addRes.body!.hash!);
print(catRes.body?.toJson());
// {Body: Hello World!}dart run example/main.dartdart testlib/
├── dart_ipfs_client.dart # Public export
└── src/
├── response/
│ ├── add.dart # Add response model
│ ├── add.g.dart # Generated JSON serializer
│ ├── cat.dart # Cat response model
│ └── cat.g.dart # Generated JSON serializer
└── service/
├── ipfs.dart # Public Ipfs class
├── ipfs_service.dart # Chopper service definition
├── ipfs_service.chopper.dart # Generated Chopper client
└── json_to_type_converter.dart # Custom response converter
example/
└── main.dart # Runnable example
test/
└── ipfs_test.dart # Unit tests
Kubo v0.42.0 daemon successfully started — RPC API listening on
127.0.0.1:5001, Daemon is ready.
"Hello World!" successfully added to IPFS and retrieved back — showing the full HTTP request/response cycle via Chopper.
All 2 tests passed after full upgrade to Dart 3 + Chopper v8.
MIT © Vanisha


