Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/samarthagarwal/woocommerce_dart
A dart package to interact with the WooCommerce REST API.
https://github.com/samarthagarwal/woocommerce_dart
dart dartlang flutter flutter-package woocommerce-api
Last synced: about 1 month ago
JSON representation
A dart package to interact with the WooCommerce REST API.
- Host: GitHub
- URL: https://github.com/samarthagarwal/woocommerce_dart
- Owner: samarthagarwal
- License: bsd-3-clause
- Created: 2018-04-18T14:02:30.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-02-12T12:48:31.000Z (12 months ago)
- Last Synced: 2024-12-19T01:31:26.441Z (about 1 month ago)
- Topics: dart, dartlang, flutter, flutter-package, woocommerce-api
- Language: Dart
- Size: 6.89 MB
- Stars: 91
- Watchers: 11
- Forks: 48
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# WooCommerce SDK for Dart
A dart package to interact with the WooCommerce API (now with null-safety). It uses OAuth1.0a behind the scenes to generate the signature and URL string for http based websites. It then makes calls and returns the data back to the calling function asynchronously.
![Example code and preview](Screenshot.png)
## Examples
### GET request (Fetch products)
```dart
Future getProducts() async {
// Initialize the API
WooCommerceAPI wooCommerceAPI = WooCommerceAPI(
url: "https://www.yourwebsite.com",
consumerKey: "ck_your_consumer_key",
consumerSecret: "cs_your_consumer_secret");// Get data using the "products" endpoint
var products = await wooCommerceAPI.getAsync("products");
return products;
}
```
You can find a full example [here](example/fetch_products.dart)### POST request (Create a customer)
```dart
Future createCustomer() async {
try {
var response = await wooCommerceAPI.postAsync(
"customers",
{
"email": '[email protected]',
"password": "123",
"billing": {
"first_name": "Samarth",
}
},
);
print(response); // JSON Object with response
} catch (e) {
print(e);
}
}
```### Report any issues if you face any or drop me an email at [email protected]