mastodon
1.4.0, released 3 weeks ago by abrah.am
Unofficial Mastodon API client generated from OpenAPI spec
WASM-ready
What it does
Provides typed Dart classes and Dio-based HTTP clients for Mastodon endpoints. Handles pagination via Link headers and supports all public API routes.
AI-written summary of version 1.4.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need a fully typed client for Mastodon in a Flutter or Dart project
- You prefer auto-generated code to avoid manual API wrappers
- You want pagination support out of the box
Skip it when
- You want a lightweight HTTP client without generated boilerplate
- You need custom request handling not covered by the generated methods
Strengths
- Fully typed API surface
- Automatic pagination parsing
- Up-to-date with Mastodon spec via generator
- Supports all platforms (web, mobile, desktop)
Weaknesses
- Large generated codebase
- Requires Dio dependency
- No custom interceptors beyond Dio
- No built-in auth helpers
Setup
- Kind
- Pure Dart
- Effort
- Medium
- Code generation
- Yes (build_runner)
- Direct dependencies
- 3
Add dio and json_annotation to pubspec, run flutter pub get. No build_runner needed as code is pre-generated.
import 'package:mastodon/mastodon.dart';
final api = Mastodon().getAccountsApi();
final response = await api.getAccount('123');
print(response);Alternatives
Packages that do the same job and could replace mastodon.
Works with
Packages commonly used together with mastodon: ones it builds on, ones built on it, and its own family.
- json_annotationmastodon depends on itProvides annotations for json_serializable to generate JSON (de)serialization code.
- diomastodon depends on itA powerful HTTP networking package for Dart and Flutter with interceptors and request cancellation.
- copy_with_extensionmastodon depends on itAnnotation for generating copyWith extensions code using copy_with_extension_gen.