wordpress_api 0.2.1 copy "wordpress_api: ^0.2.1" to clipboard
wordpress_api: ^0.2.1 copied to clipboard

outdated

A WordPress REST API client for dart with support for WooCommerce and custom namespaces.

WordPress API client for Dart | Flutter #

GitHub stars Pub Build Status Maintenance

Description #

A WordPress API client for dart with support for WooCommerce and custom namespaces/endpoints.

Features #

  • Retrieve data from standard WordPress endpoints.
  • Retrieve data from any custom namespace

Installation #

In the dependencies: section of your pubspec.yaml, add the following line:

dependencies:
  wordpress_api: <latest_version>

Usage #

  • Import the package
import 'package:wordpress_api/wordpress_api';
  • Initialize WPAPI
  WordPressAPI api = WordPressAPI('site.com');
  • Retrieve posts
  void main() async {
    final wp = WordPressAPI('site.com');
    final posts = await wp.getPosts();
    for (final post in posts) {
      print(post.title['rendered']);
    }
  }
  • Retrieve Posts with Embedded Media (Get media's source url)
  final wp = WordPressAPI('site.com');
  final posts = await wp.getPosts(args: {"_embed": true});
  for (final post in posts) {
    print(post.embedded.media[0]);
  }
  • Retrieve WP users
  final wp = WordPressAPI('site.com');
  final users = (await wp.getUsers())['data'];
  for (final user in users) {
    print(user.username);
  }
  • Retrieve data from a custom endpoint
  final wp = WordPressAPI('site.com');
  final res = await wp.getAsyc(endpoint: 'your-cutom-endpoint');
  for (final doc in res.data as List) {
    print(doc["title"]["rendered"]);
  }

Contributions are welcome, report any issues here

Special Thanks #

99
likes
0
pub points
74%
popularity

Publisher

verified publisherdhmgroup.net

A WordPress REST API client for dart with support for WooCommerce and custom namespaces.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

dio, freezed_annotation, logger, meta

More

Packages that depend on wordpress_api