Package selection guidance compiled from public package information, community data, and project usage.
A Flutter/Dart package that enables seamless interaction with the WordPress REST API. It supports common endpoints and full CRUD operations for posts, pages, comments, and more. Designed for developers building apps that integrate with WordPress-powered websites, it simplifies data retrieval and management across multiple platforms. The library is lightweight, well-documented, and actively maintained.
Use cases
Fetching blog posts and pages
Creating and updating content programmatically
Managing comments and media
Building custom WordPress frontends
Integrating WordPress as a headless CMS
Key features
Full CRUD support for core endpoints
Cross-platform compatibility
Simple, intuitive API
Supports authentication via tokens
Built-in error handling and response parsing
Suitable for
Flutter apps needing WordPress integration
Headless CMS applications
Content-driven mobile and web apps
Developers using WordPress as backend
Considerations
Requires valid WordPress REST API access
Authentication setup needed for protected endpoints
Limited to WordPress REST API features
Not suitable for complex WordPress-specific logic
Dependent on external WordPress server stability
Original README
Original README snapshot from the linked source repository. Visit the repository for the latest content.
WordPress Client
The modern, strongly‑typed WordPress REST API client for Dart & Flutter — fast, flexible, and production‑ready.
🚀 Features
📦 API discovery support.
⏲️ Measures request completion time.
📝 Supports all CRUD operations.
🌐 Supports all common REST endpoints.
🧩 GraphQL (WPGraphQL) support: client.graphql.query/mutate/raw() with auth.
🎨 Custom Requests & Authorization systems.
🔐 3 Popular authorization methods.
🗄️ Third‑party Database integration.
🔧 Middlewares for request & response operations.
🎣 Events for preprocessing response.
🚀 Execute requests in Parallel (with configurable error handling).
🧠 Optional in‑memory caching for GET requests.
🌊 Polling-based streaming for single-resource retrieve endpoints (works great with Riverpod's StreamProvider).
📦 Install
Add wordpress_client to your pubspec.yaml:
dependencies:
wordpress_client: ^9.2.0
Then run flutter pub get or dart pub get.
🔧 Quick start
Import and initialize:
import'package:wordpress_client/wordpress_client.dart';
final client = WordpressClient.forSite(
siteUrl: Uri.parse('https://example.com'),
// or: baseUrl via WordpressClient(baseUrl: Uri.parse('.../wp-json/wp/v2'))
);
🧩 GraphQL (WPGraphQL)
If your site uses the WPGraphQL plugin (canonical), you can send GraphQL operations using the same client and auth.
final client = WordpressClient.forSite(
siteUrl: Uri.parse('https://example.com'),
bootstrapper: (b) => b
.withDefaultAuthorization(
WordpressAuth.appPassword(user: 'user', appPassword: 'xxxx-xxxx'),
)
.build(),
);
// Auto-resolves https://example.com/graphql from the REST base.final result = await client.graphql.query<List<Map<String, dynamic>>>(
document: '''
query Posts($limit: Int!) {
posts(first: $limit) {
nodes { id title }
}
}
''',
variables: { 'limit': 5 },
parseData: (data) {
final nodes = (data['posts']?['nodes'] asList<dynamic>? ?? const [])
.cast<Map<String, dynamic>>();
return nodes;
},
requireAuth: false, // set true for restricted queries/mutations
);
switch (result) {
caseWordpressSuccessResponse():
print(result.data);
caseWordpressFailureResponse():
print('GraphQL error: ${result.error}');
}
// Custom endpoint path if your site exposes a different GraphQL path
client.graphql.setEndpointPath('/custom-graphql');