Skip to content
pubscout

mastodon

1.4.0, released 3 weeks ago by abrah.am

Unofficial Mastodon API client generated from OpenAPI spec

WASM-ready
$ flutter pub add mastodon
Source repository

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.

  • http

    Simpler HTTP client if you prefer not to use Dio

Works with

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