FLUTTER ECOSYSTEM

samarthagarwal/woocommerce_dart

一個用於與 WooCommerce REST API 互動的 Dart 套件。

woocommerce_dart 專案封面
Stars
91
Forks
45
最近推送(UTC)
2024年2月12日
專案狀態
未封存
Samarth Agarwal GitHub avatar
GITHUB User

Samarth Agarwal ↗

App/Web Developer, Instructor, Author, Content Creator Visit https://www.youtube.com/user/thesamarthagarwal to learn from me.

語言DartObjective-CJava

技術主題

此儲存庫發佈的套件

使用的依賴

依賴清單 4 項
  • flutter{"sdk":"flutter"}
  • crypto^3.0.1
  • http^0.13.3
  • flutter_test開發依賴{"sdk":"flutter"}

原始 README

以下為英文專案原文快照,最新內容請造訪 GitHub。

展開 / 收合專案 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

Examples

GET request (Fetch products)
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

POST request (Create a customer)
Future createCustomer() async {
  try {
    var response = await wooCommerceAPI.postAsync(
      "customers",
      {
        "email": 's@c.com',
        "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 samarthagarwal@live.com