woocommerce_api 0.0.6

  • README.md
  • Installing
  • Versions
  • 74


A dart package to interact with the WooCommerce API. It uses OAuth1.0a behind the scenes to generate the signature and URL string. It then makes calls and return the data back to the calling function.

Complete Usage Example

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:woocommerce_api/woocommerce_api.dart';

void main() => runApp(new MyApp());

class MyApp extends StatelessWidget {
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Flutter Demo',
      theme: new ThemeData(
        primarySwatch: Colors.blue,
      home: new MyHomePage(title: 'WooCommerce API Demo'),

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  _MyHomePageState createState() => new _MyHomePageState();

class _MyHomePageState extends State<MyHomePage> {

  List<Widget> products = [];

  Future getProducts() async {

    /// Initialize the API
    WooCommerceAPI wc_api = new WooCommerceAPI(
    /// Get data using the endpoint
    var p = await wc_api.getAsync("products");
    return p;

  void initState() {

  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text(widget.title),
      body: FutureBuilder(
        future: getProducts(),
        builder: (_, s){

          if(s.data == null){
            return Container(
              child: Center(
                child: Text("Loading..."),

          return ListView.builder(
            itemCount: s.data.length,
            itemBuilder: (_, index){
            /// create a list of products
              return ListTile(
                leading: CircleAvatar(
                  child: Image.network(s.data[index]["images"][0]["src"]),
                title: Text(s.data[index]["name"]),
                subtitle: Text("Buy now for \$ " + s.data[index]["price"]),



Example code's output


  • Fixed a fatal bug in types


  • Updated to work with HTTPS websites
  • Minor bug fixes
  • Updated ReadMe


  • Fixed to work without the query_string package
  • Minor bug fixes


  • Updated SDK version upper limit for new Dart version


  • Updated docs


  • Added getAsync and postAsync functions.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  woocommerce_api: ^0.0.6

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:woocommerce_api/woocommerce_api.dart';
Version Uploaded Documentation Archive
0.0.6 Oct 1, 2018 Go to the documentation of woocommerce_api 0.0.6 Download woocommerce_api 0.0.6 archive
0.0.5 Oct 1, 2018 Go to the documentation of woocommerce_api 0.0.5 Download woocommerce_api 0.0.5 archive
0.0.4 Sep 26, 2018 Go to the documentation of woocommerce_api 0.0.4 Download woocommerce_api 0.0.4 archive
0.0.3 Sep 2, 2018 Go to the documentation of woocommerce_api 0.0.3 Download woocommerce_api 0.0.3 archive
0.0.2 Apr 18, 2018 Go to the documentation of woocommerce_api 0.0.2 Download woocommerce_api 0.0.2 archive
0.0.1 Apr 18, 2018 Go to the documentation of woocommerce_api 0.0.1 Download woocommerce_api 0.0.1 archive
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Nov 14, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.6
  • Flutter: 0.11.3


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/woocommerce_api.dart. (-1.99 points)

Analysis of lib/woocommerce_api.dart reported 4 hints:

line 9 col 8: Unused import: 'package:http/http.dart'.

line 38 col 9: The value of the local variable 'token_secret' isn't used.

line 53 col 21: The operator x ~/ y is more efficient than (x / y).toInt().

line 59 col 9: The value of the local variable 'path' isn't used.

Maintenance suggestions

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use woocommerce_api.dart.

Package is pre-v0.1 release. (-10 points)

While there is nothing inherently wrong with versions of 0.0.*, it usually means that the author is still experimenting with the general direction of the API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.23.0 <3.0.0
crypto ^2.0.2+1 2.0.6
flutter 0.0.0
http ^0.11.3+16 0.11.3+17 0.12.0
Transitive dependencies
async 2.0.8
charcode 1.1.2
collection 1.14.11
convert 2.0.2
http_parser 3.1.3
meta 1.1.6
path 1.6.2
sky_engine 0.0.99
source_span 1.4.1
string_scanner 1.0.4
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies