सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।
एक Flutter/Dart पैकेज जो WordPress REST API के साथ बिना किसी दिक्कत के इंटरैक्ट करने में सक्षम बनाता है। यह सामान्य एंडपॉइंट्स और पोस्ट, पेज, कमेंट्स आदि के लिए पूर्ण CRUD ऑपरेशन समर्थित करता है। WordPress-आधारित वेबसाइट्स के साथ एप्लिकेशन बनाने वाले डेवलपर्स के लिए डिज़ाइन किया गया है, जो विभिन्न प्लेटफॉर्मों पर डेटा प्राप्त करने और प्रबंधित करने में सरलता प्रदान करता है। लाइब्रेरी हल्की, अच्छी तरह से दस्तावेज़ित है और सक्रिय रूप से बनाए रखी जा रही है।
उपयोग
ब्लॉग पोस्ट और पेज डाउनलोड कर रहा है
कार्यक्रमानुसार सामग्री बनाना और अद्यतन करना
टिप्पणियों और मीडिया का प्रबंधन
कस्टम वर्डप्रेस फ्रंटएंड बिल्ड करना
हेडलेस CMS के रूप में WordPress को एकीकृत करना
मुख्य विशेषताएँ
मुख्य एंडपॉइंट्स के लिए पूर्ण CRUD समर्थन
प्लेटफॉर्म के अनुकूलता
सरल, स्पष्ट एपीआई
टोकन के माध्यम से प्रमाणीकरण का समर्थन करता है
निर्मित त्रुटि संहार और प्रतिक्रिया विश्लेषण
इनके लिए उपयुक्त
WordPress एकीकरण की आवश्यकता वाले Flutter ऐप्स
हेडलेस CMS एप्लिकेशन
सामग्री-आधारित मोबाइल और वेब ऐप्स
WordPress के बैकएंड के रूप में उपयोग करने वाले डेवलपर्स
विचार योग्य बातें
वैध WordPress REST API पहुंच की आवश्यकता है
सुरक्षित एंडपॉइंट्स के लिए प्रमाणीकरण सेटअप की आवश्यकता है
WordPress REST API विशेषताओं तक सीमित
जटिल WordPress-विशिष्ट तर्क के लिए उपयुक्त नहीं
बाहरी WordPress सर्वर की स्थिरता पर निर्भर
मूल README
संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।
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');