A Flutter package providing a complete, type-safe wrapper for the Tumblr API v2, making it easy to integrate Tumblr functionality into your Flutter applications.
- 🔑 OAuth2 Authentication: Simple and secure authentication with Tumblr API
- 📝 Complete API Coverage:
- Blog operations (get info, fetch posts, create posts, get notes)
- User interactions (profile, dashboard, follow/unfollow, like/unlike)
- Community features (list communities, get community timeline)
- Tag-based post retrieval
- 🧩 Modern Post Format: Full support for Tumblr's Neue Post Format (NPF)
- 🧰 Type-Safe Models: Fully typed API responses using Freezed for immutable models
- 📱 Cross-Platform: Works on all platforms supported by Flutter
Add the package to your pubspec.yaml:
dependencies:
tumblr_api: ^0.0.1To use this package, you'll need:
- A Tumblr API key (obtain from Tumblr API Console)
- Flutter 3.24.1 or higher
- Dart 3.5.0 or higher
import 'package:tumblr_api/auth/oauth2_client.dart';
import 'package:tumblr_api/auth/token_response.dart';
// Initialize the OAuth client
final oauthClient = TumblrOAuth2Client(
clientId: 'YOUR_CLIENT_ID',
clientSecret: 'YOUR_CLIENT_SECRET',
redirectUri: 'YOUR_REDIRECT_URI',
authorizationEndpoint: 'https://www.tumblr.com/oauth2/authorize',
tokenEndpoint: 'https://api.tumblr.com/v2/oauth2/token',
);
// Authenticate user
final tokenResponse = await oauthClient.authenticate(
callbackUrlScheme: 'your-scheme',
scopes: ['basic', 'write', 'offline_access'],
);
// Store the access token for later use
final accessToken = tokenResponse.accessToken;The package provides a unified TumblrApi class to access all API services:
import 'package:tumblr_api/api/tumblr_api.dart';
// Initialize the API client with your access token
final tumblrApi = TumblrApi(accessToken);
// Access various services through the API client
final userService = tumblrApi.user;
final blogService = tumblrApi.blog;
final tagService = tumblrApi.tag;
final communitiesService = tumblrApi.communities;// Using the blog service through the API client
final blog = await tumblrApi.blog.getInfo('staff.tumblr.com');
print('Blog name: ${blog.name}');
print('Total posts: ${blog.posts}');
// Get blog posts
final posts = await tumblrApi.blog.getPosts(
'staff.tumblr.com',
limit: 10,
);
// Create a new post
final postId = await tumblrApi.blog.createPost(
blogIdentifier: 'your-blog.tumblr.com',
content: [
TextBlock(text: 'Hello, Tumblr!'),
// Add more content blocks as needed
],
tags: ['flutter', 'coding'],
);// Get the user's profile
final user = await tumblrApi.user.getUserProfile();
print('User name: ${user.name}');
// Get the dashboard posts
final dashboardPosts = await tumblrApi.user.getDashboardPosts(
limit: 20,
npf: true,
);
// Follow a blog
await tumblrApi.user.followBlog('staff.tumblr.com');
// Like a post
await tumblrApi.user.likePost('123456789', 'reblog_key');// Get posts with a specific tag
final posts = await tumblrApi.tag.getTaggedPosts(
'flutter',
limit: 10,
);// Get list of joined communities
final communities = await tumblrApi.communities.getCommunities();
// Get community timeline
final timeline = await tumblrApi.communities.getCommunityTimeline('programming');The package follows a service-based architecture, unified under the TumblrApi class:
tumblrApi.blog: For blog-related operationstumblrApi.user: For user-related operationstumblrApi.tag: For tag-related operationstumblrApi.communities: For community-related operations
Each service provides methods that closely match the Tumblr API endpoints while providing type-safe responses.
This package is a wrapper around the Tumblr API v2 with full support for the Neue Post Format.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.