Skip to content
pubscout

dart_twitter_api

0.6.0, released 2 years ago by an unverified publisher

A Dart wrapper for Twitter API v1.1 with typed models and endpoint methods.

Unverified publisher
$ flutter pub add dart_twitter_api
Source repository

What it does

The package provides typed service classes for Twitter v1.1 endpoints, handling OAuth1 authentication and parsing responses into Dart models. It also offers a low‑level client for custom requests.

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

Use it when

  • You need to interact with Twitter's v1.1 REST API from a Dart/Flutter app
  • You prefer typed, documented methods over manual HTTP calls
  • You want built‑in OAuth1 handling

Skip it when

  • You need Twitter API v2 support (use twitter-api-v2)
  • You require a lightweight HTTP client without code‑gen models

Strengths

  • Well‑documented endpoint methods
  • Automatic JSON (de)serialization via json_serializable
  • OAuth1 authentication built‑in
  • Supports all major platforms

Weaknesses

  • Only covers v1.1, not the newer v2 API
  • Adds build_runner step for code generation
  • Relies on http package, so no advanced features like interceptors

Setup

Kind
Pure Dart
Effort
Medium
Code generation
Yes (build_runner)
Direct dependencies
4

Add the package, run `dart pub get`, then execute `dart run build_runner build` to generate JSON models; configure OAuth1 credentials.

import 'package:dart_twitter_api/twitter_api.dart';

void main() async {
  final twitter = TwitterApi(
    consumerKey: 'YOUR_KEY',
    consumerSecret: 'YOUR_SECRET',
    accessToken: 'YOUR_TOKEN',
    accessTokenSecret: 'YOUR_TOKEN_SECRET',
  );
  final tweet = await twitter.tweetService.create(status: 'Hello from Dart!');
  print('Tweeted: ${tweet.id}');
}

Alternatives

Packages that do the same job and could replace dart_twitter_api.

Works with

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