wordpress_api 0.1.3 wordpress_api: ^0.1.3 copied to clipboard
A WordPress API client for dart with support for WooCommerce and custom namespaces.
WordPress API client for Dart (Flutter) #
Description #
A WordPress API client for flutter with support for WooCommerce and custom namespaces.
Features #
- Retrieve data from any endpoint.
- Retrieve data from any namespace.
Installation #
In the dependencies:
section of your pubspec.yaml
, add the following line:
wordpress_api: <latest_version>
Usage #
- Import the package
import 'package:wordpress_api/wordpress_api';
- Initialize WPAPI
WordPressAPI api = WordPressAPI('site.com');
- Retrieve data from a custom endpoint
void main() async {
final wp = WordPressAPI('260blog.com');
final posts = (await wp.getAsync('posts'))['data'];
for (final post in posts) {
print(post['title']['rendered']);
}
}
- Retrieve WP users
void main() async {
final wp = WordPressAPI('260blog.com');
final users = (await wp.getUsers())['data'];
for (final user in users) {
print(user['name']);
}
}
To Do #
- Add authentication function
- Add postAsync function
Contributions are welcome, report any issues here