Giter Site home page Giter Site logo

rayokaah / woocommerce Goto Github PK

View Code? Open in Web Editor NEW
122.0 12.0 110.0 6.34 MB

Woocommerce SDK for Flutter. The Complete Woo Commerce SDK for Flutter.

License: BSD 3-Clause "New" or "Revised" License

Dart 98.30% Kotlin 0.17% Swift 0.16% Objective-C 0.01% Ruby 1.36%

woocommerce's Issues

Exception when I get Coupons. type 'String' is not a subtype of type 'DateTime'

Hi!

I'm trying to get coupons but it doens't work.

This is part of my code:

class _CouponsHomeState extends State<CouponsPage> {
  List<WooCoupon> coupons = [];

  WooCommerce wooCommerce = WooCommerce(baseUrl: baseUrl, consumerKey: consumerKey, consumerSecret: consumerSecret, isDebug: true);
  Future GetCoupons() async {
    coupons = await wooCommerce.getCoupons();
    return coupons;
  }

Captura de 2020-10-02 23-01-24

Error with getProductVariationById

Hi

I am working with Product Variations to get a list of all variations of a product and I get an error at
WooProductVariation variations = await wooCommerce.getProductVariationById(productId: 31);
The reason is, since the variation parameter is not passed, it was converted to null and the query becomes Query : products/31/variations/null

I managed to pass empty string like below and the query becomes valid Query : products/31/variations/
WooProductVariation variations = await wooCommerce.getProductVariationById(productId: 31, variationId: '');

I get the following error

Unhandled Exception: type 'List<dynamic>' is not a subtype of type 'Map<String, dynamic>'
E/flutter ( 5726): #0      WooCommerce.getProductVariationById (package:woocommerce/woocommerce.dart:537:53)
E/flutter ( 5726): <asynchronous suspension>
E/flutter ( 5726): #1      _MyHomePageState.getProducts (package:ecommerce/main.dart:66:56)
E/flutter ( 5726): <asynchronous suspension>
E/flutter ( 5726): #2      _MyHomePageState.initState (package:ecommerce/main.dart:76:5)
E/flutter ( 5726): #3      StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4702:58)
E/flutter ( 5726): #4      ComponentElement.mount (package:flutter/src/widgets/framework.dart:4538:5)
E/flutter ( 5726): #5      Element.inflateWidget (package:flutter/src/widgets/framework.dart:3508:14)
E/flutter ( 5726): #6      Element.updateChild (package:flutter/src/widgets/framework.dart:3266:18)
E/flutter ( 5726): #7      SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5892:14)
E/flutter ( 5726): #8      Element.inflateWidget (package:flutter/src/widgets/framework.dart:3508:14)
E/flutter ( 5726): #9      Element.updateChild (package:flutter/src/widgets/framework.dart:3266:18)
E/flutter ( 5726): #10     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4589:16)
E/flutter ( 5726): #11     Element.rebuild (package:flutter/src/widgets/framework.dart:4280:5)
E/flutter ( 5726): #12     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4543:5)
E/flutter ( 5726): #13     ComponentElement.mount (package:flutter/src/widgets/framework.dart:4538:5)
E/flutter ( 5726): #14     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3508:14)
E/flutter ( 5726): #15     Element.updateChild (package:flutter/src/widgets/framework.dart:3266:18)
E/flutter ( 5726): #16     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5892:14)
E/flutter ( 5726): #17     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3508:14)
E/flutter ( 5726): #18     Element.updateChild (package:flutter/src/widgets/framework.dart:3266:18)
E/flutter ( 5726): #19     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5892:14)
E/flutter ( 5726): #20     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3508:14)
E/flutter ( 5726): #21     Element.updateChild (package:flutter/src/widgets/framework.dart:3266:18)
E/flutter ( 5726): #22     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4589:16)
E/flutter ( 5726): #23     StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4737:11)
E/flutter ( 5726): #24     Element.rebuild (package:flutter/src/widgets/framework.dart:4280:5)
E/flutter ( 5726): #25     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4543:5)
E/flutter ( 5726): #26     StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4728:11)
E/flutter ( 5726): #27     ComponentElement.mount (package:flutter/src/widgets/framework.dart:4538:5)
E/flutter ( 5726): #28     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3508:14)
E/flutter ( 5726): #29     Element.updateChild (package:flutter/src/widgets/framework.dart:3266:18)
E/flutter ( 5726): #30     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5892:14)
E/flutter ( 5726): #31     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3508:14)
E/flutter ( 5726): #32     Element.updateChild (package:flutter/src/widgets/framework.dart:3266:18)
E/flutter ( 5726): #33     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5892:14)
E/flutter ( 5726): #34     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3508:14)
E/flutter ( 5726): #35     Element.updateChild (package:flutter/src/widgets/framework.dart:3266:18)
E/flutter ( 5726): #36     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4589:16)
E/flutter ( 5726): #37     StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4737:11)
E/flutter ( 5726): #38     Element.rebuild (package:flutter/src/widgets/framework.dart:4280:5)
E/flutter ( 5726): #39     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4543:5)
E/flutter ( 5726): #40     StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4728:11)
E/flutter ( 5726): #41     ComponentElement.mount (package:flutter/src/widgets/framework.dart:4538:5)
E/flutter ( 5726): #42     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3508:14)
E/flutter ( 5726): #43     Element.updateChild (package:flutter/src/widgets/framework.dart:3266:18)
E/flutter ( 5726): #44     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4589:16)
E/flutter ( 5726): #45     Element.rebuil

Please handle the null exception and the error above.

Please help.

AddtoCart is Not Working..

Its really an awesome plugin but add to cart is not working.. im getting this error :-

Exception has occurred.
_Exception (Exception: WooCommerce Error!
code: woocommerce_rest_missing_nonce
message: Missing the X-WC-Store-API-Nonce header. This endpoint requires a valid nonce.
status: 401)

and make your documentation well... its not clear how to use this... Thanks

I have problems using Cart

I have problems using Cart. Can someone give 1 example to use myCart(WooCart) and WooOrderPayload?
Thanks.

getting error for constructing customer model using fromJson

E/flutter (18930): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: type 'List<dynamic>' is not a subtype of type 'String'
E/flutter (18930): #0      new WooCustomerMetaData.fromJson (package:woocommerce/models/customer.dart:142:15)
E/flutter (18930): #1      new WooCustomer.fromJson.<anonymous closure> (package:woocommerce/models/customer.dart:91:68)

Get Product Review (Exception has occurred.)

I am trying to get reviews of a product:

final response = await wooCommerce.getProductReviews(product: [product.id]);

response:

Exception has occurred. _Exception (Exception: WooCommerce Error! code: rest_no_route message: No route was found matching the URL and request method. status: 404)

Error: type 'String is not a subtype of type int.

class WooCommerceApi {
WooCommerce prodMode = WooCommerce(
baseUrl: Config.url,
consumerKey: Config.key,
consumerSecret: Config.secret,
isDebug: true,
);

Future<List> getProductsRealDomain() async {
final dynamic myProducts = await prodMode.getProducts();
print("WooCommerceApi === getProducts1 : ${myProducts.length}");
return myProducts;
}
}

products shows in debug console but gives error on screen.
When I debug, it directs me to WooProduct - totalSales in the package.
Please Any help. Thanks

Future<List<WooProductCategory>> getProductCategories

Exception has occurred.
_Exception (Exception: WooCommerce Error!
code: rest_invalid_param

calling woocommerce.getProductCategories(orderby: "") throws the exception above with the message:
Orderby isn't a valid parameter.

getProducts return 401

Hello ! I am trying to use this plugin in my flutter app.
But I have an error when I test

products = await wooCommerce.getProducts ();
I have a 401 error: invalid signature

When I do the test with postman, there is no problem, but in the app, no.
the consumerKey and consumerSecret are correct

Multiple tags filter option not working on localhost

Environment:

MacBook Pro 16 - macOS Big Sur
Wordpress local website using "Local" application for macOS

Base URL: http://ecommercestore.local

When I call a request to getProducts with multiple tags like tags: '55,56' I get the following logs:

flutter: WOOCOMMERCE LOG : Parameters: {page: 1, per_page: 20, tag: 55,56}
flutter: WOOCOMMERCE LOG : Query : products?page=1&per_page=20&tag=55%2C56
flutter: WOOCOMMERCE LOG : oauth token = :
flutter: WOOCOMMERCE LOG : this is the bearer token : Bearer 0
flutter: ERROR
flutter: ERROR │ ⛔ Exception: WooCommerce Error!
flutter: ERROR │ ⛔ code: woocommerce_rest_authentication_error
flutter: ERROR │ ⛔ message: Invalid signature - provided signature does not match.
flutter: ERROR │ ⛔ status: 401

Is there any way to resolve this issue ?

The method 'add' was called on null. Receiver: null Tried calling: add(instance of 'WooCoupon')

When I try to get coupons it show and error:

First of all, I apply this fix to coupon.dart file

After that, when I try to get coupons it shows that error:
Error: NosuchmethodError: The method 'add' was called on null. Receiver: null Tried calling: add(instance of 'WooCoupon')

This is my code:

body: FutureBuilder(
        future: GetCoupons(),
        builder: (BuildContext context, AsyncSnapshot snapshot) {
          if (snapshot.hasData) {
            return Text(snapshot.data.toString());
          } else if (snapshot.hasError) {
            return Scaffold(
              body: Center(
                child: Text('Error: ${snapshot.error}', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16))
              )
            );
          } else return Center(child: CircularProgressIndicator());
        }
      )

and this:

class _CouponsHomeState extends State<CouponsPage> {
  List<WooCoupon> coupons = [];

  WooCommerce wooCommerce = WooCommerce(baseUrl: baseUrl, consumerKey: consumerKey, consumerSecret: consumerSecret, isDebug: true);

  Future GetCoupons() async {
    coupons = await wooCommerce.getCoupons();
    setState(() {

    });;
  }

error in get order

there is an exception in get order when using status filter
` Map<String, dynamic> payload = {};

({
  'page': page,
  'per_page': perPage,
  'search': search,
  'after': after,
  'before': before,
  'exclude': exclude,
  'include': include,
  'offset': offset,
  'order': order,
  'orderby': orderBy,
  'parent': parent,
  'parent_exclude': parentExclude,
  'status': status,
  'customer': customer,
  'product': product,
  'dp': dp,
}).forEach((k, v) {
  if (v != null)
    payload[k] = v.toString();
});`

this map put value in []

WooCommerceError message

try { result = await woocommerce.createCustomer(sut); Get.back(); } on WooCommerceError catch (e) { Get.back(); mess = e.message; Get.defaultDialog( barrierDismissible: false, title: 'Oops!', textCancel: 'close', onCancel: () {}, middleText: e.message); }

I have been trying to display the error message whenever a user creates an account but this is not working what am I doing wrong

Erro HTTP

Hello,
i just executed
"flutter create wooExampleApp"
added "woocommerce: ^ 0.9.0" to the premises
and "import 'package: woocommerce / woocommerce.dart';" in main.dart
when I run "flutter run", I get the error:

Compiler message:                                                       
../../../flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.1/lib/http.dart:72:77: Error: Expected '}' before this.
          client.post(url, headers: headers, body: body, encoding: encoding);
                                                                            ^
../../../flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.1/lib/http.dart:70:9: Error: A value of type 'Set<Future<Response>>' can't be assigned to a variable of type 'Future<Response>'.
 - 'Set' is from 'dart:core'.
 - 'Future' is from 'dart:async'.                                       
 - 'Response' is from 'package:http/src/response.dart' ('../../../flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.1/lib/src/response.dart').
        {
        ^
Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
build failed.
                                                                        
FAILURE: Build failed with an exception.
                                                                        
* Where:
Script 'C:\Dev\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 882

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\Dev\flutter\bin\flutter.bat'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 54s

SDK:
environment:
sdk: ">=2.7.0 <3.0.0"

any help?

Product endpoint not working proper when pass search string and category

endpoint : wp-json/wc/v3/products

consumer_key: ck_##############################
consumer_secret: cs_#############################
search:mdh
per_page:10
page:1
orderby:modified
order:desc
category:37

Above is the request parameter when I try to pass both category id and the search string i always get the blank list, I also cross-check that category ID 37 have items with MDH name

Please help me if anyone has a solution for this issue.

Thanks in advance.

Facing Unhandled Exception: Exception: No Internet connection.

`Here is the code -
import 'package:flutter/material.dart';
import 'package:woocommerce/woocommerce.dart';

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

class MyApp extends StatelessWidget {
// This widget is the root of your application.
@OverRide
Widget build(BuildContext context) {
return MaterialApp(
title: 'WooCommerce Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: "Woo Commerce Demo"),
);
}
}

String baseUrl = "http://localhost/wordpress/wp-json/wp/v2/product";
String consumerKey = "ck_-------d";
String consumerSecret = "cs_---------f";

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

final String title;

@OverRide
_MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State {

List products = [];
List featuredProducts = [];
WooCommerce wooCommerce = WooCommerce(
baseUrl: baseUrl,
consumerKey: consumerKey,
consumerSecret: consumerSecret,
isDebug: true,
);

getProducts() async{
products = await wooCommerce.getProducts();
setState(() {
});
print(products.toString());
}

@OverRide
void initState() {
super.initState();
//You would want to use a feature builder instead.
getProducts();

}
@OverRide
Widget build(BuildContext context) {
var size = MediaQuery.of(context).size;
final double itemHeight = (size.height - kToolbarHeight - 24) / 2;
final double itemWidth = size.width / 2;
return
Scaffold(
body: SafeArea(
child: CustomScrollView(
slivers: [
SliverToBoxAdapter(
child: Container(
margin: EdgeInsets.all(10),
child: Text('My Awesome Shop',
style: Theme.of(context).textTheme.headline.apply(color: Colors.blueGrey),
),),
),
SliverGrid(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
childAspectRatio: (itemWidth / itemHeight),
mainAxisSpacing: 2,
crossAxisSpacing: 1,
),

            delegate: SliverChildBuilderDelegate(
                  (BuildContext context, int index) {
                final product = products[index];
                return
                  Column(
                    mainAxisAlignment: MainAxisAlignment.end,
                    children: <Widget>[
                      Container(
                        height: 230,
                        width: 200,
                        margin: EdgeInsets.all(10),
                        decoration: BoxDecoration(
                          image: DecorationImage(image: NetworkImage(product.images[0].src,),
                              fit: BoxFit.cover),
                          color: Colors.pinkAccent,
                          borderRadius: BorderRadius.all(Radius.circular(10)),
                        ),
                        //child: Image.network(product.images[0].src, fit: BoxFit.cover,),
                      ),
                      Text(product.name?? 'Loading...', style: Theme.of(context).textTheme.title.apply(color: Colors.blueGrey),),
                      Text('\$'+product.price?? '', style: Theme.of(context).textTheme.subtitle,)
                    ],
                  );
              },
              childCount: products.length,
            ),
          )
        ],
      ),
    ),
  );

}
}
`

authenticateViaJWT returns rest_no_route

I have tried to implement the authenticateViaJWT method following the docs but I get some errors.

This is my code:

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

WooCommerce woocommerce = WooCommerce(
  baseUrl: kWoocommerceBaseUrl,
  consumerKey: kWoocommerceConsumerKey,
  consumerSecret: kWoocommerceConsumerSecret,
);

class LoginPage extends StatefulWidget {
  static const routeName = '/login';

  @override
  _LoginPageState createState() => _LoginPageState();
}

class _LoginPageState extends State<LoginPage> {
  final _formKey = GlobalKey<FormState>();
  final TextEditingController _emailController = new TextEditingController();
  final TextEditingController _passwordController = new TextEditingController();

  String _email;
  String _password;
  bool _isLoading = false;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: LoadingOverlay(
        isLoading: _isLoading,
        progressIndicator: isAndroid
            ? CircularProgressIndicator()
            : CupertinoActivityIndicator(),
        child: SafeArea(
          child: Container(
            padding: EdgeInsets.all(16.0),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.stretch,
              children: <Widget>[
                Expanded(
                  child: Container(
                    child: Center(
                      child: Text(
                        'Login',
                        style: TextStyle(
                          fontSize: 30.0,
                          fontWeight: FontWeight.bold,
                        ),
                      ),
                    ),
                  ),
                ),
                Form(
                  key: _formKey,
                  child: _buildTextFields(),
                ),
                SizedBox(
                  height: 16.0,
                ),
                AmButton(
                  text: 'Login',
                  onPressed: () async {
                    if (_formKey.currentState.validate()) {
                      FocusScope.of(context).unfocus();

                      setState(() {
                        // _isLoading = true;
                      });

                      print(_email);
                      print(_password);

                      //Login - Returns the access token on success.

                      final token = await woocommerce.authenticateViaJWT(
                          username: _email, password: _password);

                      print(token);
                    }
                  },
                ),
                SizedBox(
                  height: 8.0,
                ),
                Expanded(
                  child: Container(),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }

  Widget _buildTextFields() {
    return Container(
      child: Column(
        children: <Widget>[
          Container(
            child: TextFormField(
              controller: _emailController,
              decoration: InputDecoration(labelText: 'Email'),
              validator: (value) => _checkEmailAddress(value),
            ),
          ),
          Container(
            child: TextFormField(
              controller: _passwordController,
              decoration: InputDecoration(labelText: 'Password'),
              obscureText: true,
              validator: (value) => _checkPassword(value),
            ),
          )
        ],
      ),
    );
  }

  bool _isValidEmailAddress(email) {
    return RegExp(
            r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+")
        .hasMatch(email);
  }

  String _checkEmailAddress(email) {
    if (email.isEmpty) {
      return 'Devi inserire la tua email';
    }

    if (!_isValidEmailAddress(email)) {
      return 'Devi inserire un indirizzo email valido';
    }

    setState(() {
      _email = email;
    });

    return null;
  }

  String _checkPassword(value) {
    if (value.isEmpty) {
      return 'Devi inserire la password';
    }

    setState(() {
      _password = value;
    });

    return null;
  }
}

the authenticateViaJWT method is used in a onPressed callback, here the code:

onPressed: () async {
                    if (_formKey.currentState.validate()) {
                      FocusScope.of(context).unfocus();

                      setState(() {
                        // _isLoading = true;
                      });

                      print(_email);
                      print(_password);

                      //Login - Returns the access token on success.

                      final token = await woocommerce.authenticateViaJWT(
                          username: _email, password: _password);

                      print(token);
                    }
                  },

as you can see nothing complicated.
The problem is that when I press the button I get:

[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: WooCommerce Error!
code: rest_no_route
message: No Path provides a match between the URL and the request mode
status: 404
#0      WooCommerce.authenticateViaJWT (package:woocommerce/woocommerce.dart:196:9)
<asynchronous suspension>
#1      _LoginPageState.build.<anonymous closure> (package:testwoocommerce/pages/login.dart:82:55)
#2      _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:779:19)
#3      _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:862:36)
#4      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24)
#5      TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:504:11)
#6      BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:282:5)
#7      BaseTapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:217:7)
#8      PrimaryPointerGestureRecognizer.handleEven<…>

any idea?

API responses are very slow. Using JWT plugin for every call could be the cause.

I am developing an app for Woocommerce grocery store where the number of products would be generally more. I just completed my homepage section and it works well so far. I thought to use woocommerce sdk to speed up my development.

I just replaced one of widget(Top selling tag) with get_products('tag': tagid). Later I realized that the products are loading extremely slow.

I use Dio for http calls. it would be a direct call with consumer key and secrest. JWT plugin is used only for authenticating the user. The response is really good. products load quick.

reconsider the design to improve the performance. That will make this SDK a real gamechanger.

Woocommerce App

Does any one have ready woocommerce app with this plugin?

message: Missing OAuth parameter oauth_token

Hello!
When i try example, i get error:

code: json_oauth1_missing_parameter
message: Missing OAuth parameter oauth_token
status: 401)

I set baseUrl,consumerKey,consumerSecret

Categories and sub categories

Does anyone know how to order the categories and sub categories? intended to make a kind of menu with the main categories and then within each category the corresponding subcategories.

woocommerce.loginCustomer(...) JWT ERROR

  • wordpress version: 5.7

  • fluter version: 2.0.2

  • plugin used (enabled): JWT Authentication for WP-API (Version 1.2.6)

  • code sample:
    final res = await _wooCommerce.loginCustomer( username: usernameController.text, password: passwordController.text); print(res.toString());

  • error shown:
    I/flutter (11802): JWT is not configurated properly, please contact the admin
    PS: works fine with I register new customer, but afterwords I can't : LogOut, Login.

Anyone having this issue ?

authenticateViaJWT get null

When trying to authenticate by JWT, the authenticateViaJWT method returns null.

I made the debug and the authentication is being done and returns the status 200 and all the info, but in the method

WooJWTResponse authResponse =
_authToken = authResponse.token;

is passed null.

before the response has all the info

401 Invalid signature - provided signature does not match on getProducts

Hi,
Thanks for a great plugin.

I can get the Bearer token successfully in Auth section and I can login the user but it doesn't work on getProducts. I'm getting the following error message. I have tried with both 0.9.6 and 0.9.7 but gives the same error.

Please help.

Below is my code

class _MyHomePageState extends State<MyHomePage> {

  WooCommerce woocommerce = WooCommerce(
      baseUrl: 'http://10.0.2.2/visiontc/',
      consumerKey: 'ck_f59c0dac614f0ad3be227fb6970a5b03e2bbc216',
      consumerSecret: 'cs_26c4cefada04bb1bd6fbbb0c3aac9dfc42296291',
      apiPath: '/wp-json/wc/v2/',
      isDebug: true,
  );

  @override
  void initState() {
    getData();
    super.initState();
  }

  void getData() async {
    final token = woocommerce.authenticateViaJWT(username: 'admin', password: 'admin');

    final customer = woocommerce.loginCustomer(username: 'admin', password: 'admin');

    bool isLoggedIn = await woocommerce.isCustomerLoggedIn();

    if(isLoggedIn)
      print('**USER LOGGED IN ****');

    final myProducts = await woocommerce.getProducts();
    //print(myProducts.toString());
  }

  @override
  Widget build(BuildContext context) {
    return Container();
  }
}

Below is the error message

E/flutter ( 4535): [ERROR:flutter/lib/ui/ui_dart_state.cc(171)] Unhandled Exception: Exception: WooCommerce Error!
E/flutter ( 4535): code: woocommerce_rest_authentication_error
E/flutter ( 4535): message: Invalid signature - provided signature does not match.
E/flutter ( 4535): status: 401
E/flutter ( 4535): #0      WooCommerce._handleHttpError (package:woocommerce/woocommerce.dart:1557:9)
E/flutter ( 4535): #1      WooCommerce.get (package:woocommerce/woocommerce.dart:1634:7)
E/flutter ( 4535): <asynchronous suspension>
E/flutter ( 4535): #2      WooCommerce.getProducts (package:woocommerce/woocommerce.dart:457:28)
E/flutter ( 4535): #3      _MyHomePageState.getData (package:ecommerce/main.dart:58:42)
E/flutter ( 4535): #4      _rootRunUnary (dart:async/zone.dart:1198:47)
E/flutter ( 4535): #5      _CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter ( 4535): #6      _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
E/flutter ( 4535): #7      Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
E/flutter ( 4535): #8      Future._propagateToListeners (dart:async/future_impl.dart:725:32)
E/flutter ( 4535): #9      Future._completeWithValue (dart:async/future_impl.dart:529:5)
E/flutter ( 4535): #10     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:40:15)
E/flutter ( 4535): #11     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:311:13)
E/flutter ( 4535): #12     WooCommerce.isCustomerLoggedIn (package:woocommerce/woocommerce.dart)
E/flutter ( 4535): #13     _rootRunUnary (dart:async/zone.dart:1198:47)
E/flutter ( 4535): #14     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter ( 4535): #15     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
E/flutter ( 4535): #16     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
E/flutter ( 4535): #17     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
E/flutter ( 4535): #18     Future._completeWithValue (dart:async/future_impl.dart:529:5)
E/flutter ( 4535): #19     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:40:15)
E/flutter ( 4535): #20     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:311:13)
E/flutter ( 4535): #21     LocalDatabaseService.getSecurityToken (package:woocommerce/utilities/local_db.dart)
E/flutter ( 4535): #22     _rootRunUnary (dart:async/zone.dart:1198:47)
E/flutter ( 4535): #23     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter ( 4535): #24     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
E/flutter ( 4535): #25     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
E/flutter ( 4535): #26     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
E/flutter ( 4535): #27     Future._completeWithValue (dart:async/future_impl.dart:529:5)
E/flutter ( 4535): #28     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:40:15)
E/flutter ( 4535): #29     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:311:13)
E/flutter ( 4535): #30     FlutterSecureStorage.read (package:flutter_secure_storage/flutter_secure_storage.dart)
E/flutter ( 4535): #31     _rootRunUnary (dart:async/zone.dart:1198:47)
E/flutter ( 4535): #32     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter ( 4535): #33     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
E/flutter ( 4535): #34     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
E/flutter ( 4535): #35     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
E/flutter ( 4535): #36     Future._completeWithValue (dart:async/future_impl.dart:529:5)
E/flutter ( 4535): #37     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:40:15)
E/flutter ( 4535): #38     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:311:13)
E/flutter ( 4535): #39     MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart)
E/flutter ( 4535): #40     _rootRunUnary (dart:async/zone.dart:1198:47)
E/flutter ( 4535): #41     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter ( 4535): #42     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
E/flutter ( 4535): #43     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
E/flutter ( 4535): #44     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
E/flutter ( 4535): #45     Future._completeWithValue (dart:async/future_impl.dart:529:5)
E/flutter ( 4535): #46     Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:567:7)
E/flutter ( 4535): #47     _rootRun (dart:async/zone.dart:1190:13)
E/flutter ( 4535): #48     _CustomZone.run (dart:async/zone.dart:1093:19)
E/flutter ( 4535): #49     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
E/flutter ( 4535): #50     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
E/flutter ( 4535): #51     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
E/flutter ( 4535): #52     _st

Dependency not working properly

I tired to use this SDK. The moment i add the dependency in pbspec to one my already working apps the app is not able to get started

What could be the issue.

Even tried to use your example app. The fails to launch the AVD.

WooCommerce rest authentication error

When I try to get data from my http website, I get this error that I don't know what to make of it.

I/flutter (32093): WOOCOMMERCE LOG : Parameters: {} I/flutter (32093): WOOCOMMERCE LOG : Query : products? I/flutter (32093): WOOCOMMERCE LOG : oauth token = : I/flutter (32093): WOOCOMMERCE LOG : this is the bearer token : Bearer 0 E/flutter (32093): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: Exception: WooCommerce Error! E/flutter (32093): code: woocommerce_rest_authentication_error E/flutter (32093): message: امضاء نامعتبر است - امضای ارائه شده مطابقت ندارد. E/flutter (32093): status: 401 E/flutter (32093): #0 WooCommerce._handleHttpError (package:woocommerce/woocommerce.dart:1566:9) E/flutter (32093): #1 WooCommerce.get (package:woocommerce/woocommerce.dart:1643:7) E/flutter (32093): <asynchronous suspension> E/flutter (32093): #2 WooCommerce.getProducts (package:woocommerce/woocommerce.dart:458:28) E/flutter (32093): #3 _WooCommerceTestState.getProducts (package:mezon_app/Pages/testingWooCommerce.dart:25:34) E/flutter (32093): #4 _WooCommerceTestState.initState (package:mezon_app/Pages/testingWooCommerce.dart:34:5) E/flutter (32093): #5 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4765:58) E/flutter (32093): #6 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4601:5) E/flutter (32093): #7 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14) E/flutter (32093): #8 Element.updateChild (package:flutter/src/widgets/framework.dart:3327:18) E/flutter (32093): #9 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6118:14) E/flutter (32093): #10 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14) E/flutter (32093): #11 Element.updateChild (package:flutter/src/widgets/framework.dart:3327:18) E/flutter (32093): #12 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4652:16) E/flutter (32093): #13 Element.rebuild (package:flutter/src/widgets/framework.dart:4343:5) E/flutter (32093): #14 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4606:5) E/flutter (32093): #15 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4601:5) E/flutter (32093): #16 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14) E/flutter (32093): #17 Element.updateChild (package:flutter/src/widgets/framework.dart:3327:18) E/flutter (32093): #18 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6118:14) E/flutter (32093): #19 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14) E/flutter (32093): #20 Element.updateChild (package:flutter/src/widgets/framework.dart:3327:18) E/flutter (32093): #21 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6118:14) E/flutter (32093): #22 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14) E/flutter (32093): #23 Element.updateChild (package:flutter/src/widgets/framework.dart:3327:18) E/flutter (32093): #24 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4652:16) E/flutter (32093): #25 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4800:11) E/flutter (32093): #26 Element.rebuild (package:flutter/src/widgets/framework.dart:4343:5) E/flutter (32093): #27 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4606:5) E/flutter (32093): #28 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4791:11) E/flutter (32093): #29 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4601:5) E/flutter (32093): #30 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14) E/flutter (32093): #31 Element.updateChild (package:flutter/src/widgets/framework.dart:3327:18) E/flutter (32093): #32 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6118:14) E/flutter (32093): #33 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14) E/flutter (32093): #34 Element.updateChild (package:flutter/src/widgets/framework.dart:3327:18) E/flutter (32093): #35 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6118:14) E/flutter (32093): #36 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14) E/flutter (32093): #37 Element.updateChild (package:flutter/src/widgets/framework.dart:3327:18) E/flutter (32093): #38 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4652:16) E/flutter (32093): #39 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4800:11) E/flutter (32093): #40 Element.rebuild (package:flutter/src/widgets/framework.dart:4343:5) E/flutter (32093): #41 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4606:5) E/flutter (32093): #42 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4791:11) E/flutter (32093): #43 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4601:5)

I've checked the API settings and everything but it doesn't work anyway. I even can get the data using Insomnia (via OAuth 1.0) but I don't know what's wrong.

woocommerce.deleteCustomer(...) isn't working

Trying to delete customer account using the provided methode by the package woocommerce.deleteCustomer(...)

My code:

Future<WooCustomer> delete() async {
    final id = _dbService.getData().id;
    WooCustomer _wooCustomer;
    try {
      _wooCustomer = await _customerController.wooCommerce.value
          .deleteCustomer(customerId: id);
      if (_wooCustomer != null) {
        return _wooCustomer;
      }

    } catch (e) {
            _logger.e(e); //for prints
    }

The error i'm getting from _logger.e(e)

error: status code 501 Not Implemented

Anyone have the same problem ? Or any suggestion or how to delete a customer account ? thanks!

bug: unable to do getproducts

while I am trying to fetch products

E/flutter (15453): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: type 'String' is not a subtype of type 'int'
E/flutter (15453): #0      new WooProduct.fromJson (package:woocommerce/models/products.dart:172:20)
E/flutter (15453): #1      WooCommerce.getProducts (package:woocommerce/woocommerce.dart:461:29)

can anyone get me fix

Custom Endpoints

Is there any documentation on how to create custom endpoints?

Would you like to be able to log in as an administrator and add products is possible?

Thanks

return WooJWTResponse authResponse null

inside authenticationJWT, response.body (body returns token, nicename ...)
but when assigning WooJWTResponse authResponse =
WooJWTResponse.fromJson (json.decode (response.body));

then authResponse == null.

Has anyone encountered this error, please help me

auth token is showing null

this my code:
WooCommerce woocommerce = WooCommerce(
baseUrl: yourBaseUrl,
consumerKey: yourConsumerKey,
consumerSecret: consumerSecret);

after init this code,when i call authtoken ,its showing error

oauth token = :

cart.dart Model Incomplete

Hi, the WooCart model you have is incomplete, it doesn't have a total and it doesn't have the right price of the items.

This is a model that gets all the data correctly:

Can you add it in a new version of the plugin?

import 'dart:convert';

WooCart wooCartFromJson(String str) => WooCart.fromJson(json.decode(str));

String wooCartToJson(WooCart data) => json.encode(data.toJson());

class WooCart {
    WooCart({
        this.coupons,
        this.shippingRates,
        this.shippingAddress,
        this.items,
        this.itemsCount,
        this.itemsWeight,
        this.needsPayment,
        this.needsShipping,
        this.totals,
        this.errors,
    });

    List<dynamic> coupons;
    List<dynamic> shippingRates;
    ShippingAddress shippingAddress;
    List<WooCartItems> items;
    int itemsCount;
    int itemsWeight;
    bool needsPayment;
    bool needsShipping;
    WooCartTotals totals;
    List<dynamic> errors;

    factory WooCart.fromJson(Map<String, dynamic> json) => WooCart(
        coupons: List<dynamic>.from(json["coupons"].map((x) => x)),
        shippingRates: List<dynamic>.from(json["shipping_rates"].map((x) => x)),
        shippingAddress: ShippingAddress.fromJson(json["shipping_address"]),
        items: List<WooCartItems>.from(json["items"].map((x) => WooCartItems.fromJson(x))),
        itemsCount: json["items_count"],
        itemsWeight: json["items_weight"],
        needsPayment: json["needs_payment"],
        needsShipping: json["needs_shipping"],
        totals: WooCartTotals.fromJson(json["totals"]),
        errors: List<dynamic>.from(json["errors"].map((x) => x)),
    );

    Map<String, dynamic> toJson() => {
        "coupons": List<dynamic>.from(coupons.map((x) => x)),
        "shipping_rates": List<dynamic>.from(shippingRates.map((x) => x)),
        "shipping_address": shippingAddress.toJson(),
        "items": List<WooCartItems>.from(items.map((x) => x.toJson())),
        "items_count": itemsCount,
        "items_weight": itemsWeight,
        "needs_payment": needsPayment,
        "needs_shipping": needsShipping,
        "totals": totals.toJson(),
        "errors": List<dynamic>.from(errors.map((x) => x)),
    };
}

class WooCartItems {
    WooCartItems({
        this.key,
        this.id,
        this.quantity,
        this.quantityLimit,
        this.name,
        this.shortDescription,
        this.description,
        this.sku,
        this.lowStockRemaining,
        this.backordersAllowed,
        this.showBackorderBadge,
        this.soldIndividually,
        this.permalink,
        this.images,
        this.variation,
        this.prices,
        this.totals,
    });

    String key;
    int id;
    int quantity;
    int quantityLimit;
    String name;
    String shortDescription;
    String description;
    String sku;
    dynamic lowStockRemaining;
    bool backordersAllowed;
    bool showBackorderBadge;
    bool soldIndividually;
    String permalink;
    List<Image> images;
    List<dynamic> variation;
    Prices prices;
    ItemTotals totals;

    factory WooCartItems.fromJson(Map<String, dynamic> json) => WooCartItems(
        key: json["key"],
        id: json["id"],
        quantity: json["quantity"],
        quantityLimit: json["quantity_limit"],
        name: json["name"],
        shortDescription: json["short_description"],
        description: json["description"],
        sku: json["sku"],
        lowStockRemaining: json["low_stock_remaining"],
        backordersAllowed: json["backorders_allowed"],
        showBackorderBadge: json["show_backorder_badge"],
        soldIndividually: json["sold_individually"],
        permalink: json["permalink"],
        images: List<Image>.from(json["images"].map((x) => Image.fromJson(x))),
        variation: List<dynamic>.from(json["variation"].map((x) => x)),
        prices: Prices.fromJson(json["prices"]),
        totals: ItemTotals.fromJson(json["totals"]),
    );

    Map<String, dynamic> toJson() => {
        "key": key,
        "id": id,
        "quantity": quantity,
        "quantity_limit": quantityLimit,
        "name": name,
        "short_description": shortDescription,
        "description": description,
        "sku": sku,
        "low_stock_remaining": lowStockRemaining,
        "backorders_allowed": backordersAllowed,
        "show_backorder_badge": showBackorderBadge,
        "sold_individually": soldIndividually,
        "permalink": permalink,
        "images": List<dynamic>.from(images.map((x) => x.toJson())),
        "variation": List<dynamic>.from(variation.map((x) => x)),
        "prices": prices.toJson(),
        "totals": totals.toJson(),
    };
}

class Image {
    Image({
        this.id,
        this.src,
        this.thumbnail,
        this.srcset,
        this.sizes,
        this.name,
        this.alt,
    });

    int id;
    String src;
    String thumbnail;
    String srcset;
    String sizes;
    String name;
    String alt;

    factory Image.fromJson(Map<String, dynamic> json) => Image(
        id: json["id"],
        src: json["src"],
        thumbnail: json["thumbnail"],
        srcset: json["srcset"],
        sizes: json["sizes"],
        name: json["name"],
        alt: json["alt"],
    );

    Map<String, dynamic> toJson() => {
        "id": id,
        "src": src,
        "thumbnail": thumbnail,
        "srcset": srcset,
        "sizes": sizes,
        "name": name,
        "alt": alt,
    };
}

class Prices {
    Prices({
        this.currencyCode,
        this.currencySymbol,
        this.currencyMinorUnit,
        this.currencyDecimalSeparator,
        this.currencyThousandSeparator,
        this.currencyPrefix,
        this.currencySuffix,
        this.price,
        this.regularPrice,
        this.salePrice,
        this.priceRange,
        this.rawPrices,
    });

    String currencyCode;
    String currencySymbol;
    int currencyMinorUnit;
    String currencyDecimalSeparator;
    String currencyThousandSeparator;
    String currencyPrefix;
    String currencySuffix;
    String price;
    String regularPrice;
    String salePrice;
    dynamic priceRange;
    RawPrices rawPrices;

    factory Prices.fromJson(Map<String, dynamic> json) => Prices(
        currencyCode: json["currency_code"],
        currencySymbol: json["currency_symbol"],
        currencyMinorUnit: json["currency_minor_unit"],
        currencyDecimalSeparator: json["currency_decimal_separator"],
        currencyThousandSeparator: json["currency_thousand_separator"],
        currencyPrefix: json["currency_prefix"],
        currencySuffix: json["currency_suffix"],
        price: json["price"],
        regularPrice: json["regular_price"],
        salePrice: json["sale_price"],
        priceRange: json["price_range"],
        rawPrices: RawPrices.fromJson(json["raw_prices"]),
    );

    Map<String, dynamic> toJson() => {
        "currency_code": currencyCode,
        "currency_symbol": currencySymbol,
        "currency_minor_unit": currencyMinorUnit,
        "currency_decimal_separator": currencyDecimalSeparator,
        "currency_thousand_separator": currencyThousandSeparator,
        "currency_prefix": currencyPrefix,
        "currency_suffix": currencySuffix,
        "price": price,
        "regular_price": regularPrice,
        "sale_price": salePrice,
        "price_range": priceRange,
        "raw_prices": rawPrices.toJson(),
    };
}

class RawPrices {
    RawPrices({
        this.precision,
        this.price,
        this.regularPrice,
        this.salePrice,
    });

    int precision;
    String price;
    String regularPrice;
    String salePrice;

    factory RawPrices.fromJson(Map<String, dynamic> json) => RawPrices(
        precision: json["precision"],
        price: json["price"],
        regularPrice: json["regular_price"],
        salePrice: json["sale_price"],
    );

    Map<String, dynamic> toJson() => {
        "precision": precision,
        "price": price,
        "regular_price": regularPrice,
        "sale_price": salePrice,
    };
}

class ItemTotals {
    ItemTotals({
        this.currencyCode,
        this.currencySymbol,
        this.currencyMinorUnit,
        this.currencyDecimalSeparator,
        this.currencyThousandSeparator,
        this.currencyPrefix,
        this.currencySuffix,
        this.lineSubtotal,
        this.lineSubtotalTax,
        this.lineTotal,
        this.lineTotalTax,
    });

    String currencyCode;
    String currencySymbol;
    int currencyMinorUnit;
    String currencyDecimalSeparator;
    String currencyThousandSeparator;
    String currencyPrefix;
    String currencySuffix;
    String lineSubtotal;
    String lineSubtotalTax;
    String lineTotal;
    String lineTotalTax;

    factory ItemTotals.fromJson(Map<String, dynamic> json) => ItemTotals(
        currencyCode: json["currency_code"],
        currencySymbol: json["currency_symbol"],
        currencyMinorUnit: json["currency_minor_unit"],
        currencyDecimalSeparator: json["currency_decimal_separator"],
        currencyThousandSeparator: json["currency_thousand_separator"],
        currencyPrefix: json["currency_prefix"],
        currencySuffix: json["currency_suffix"],
        lineSubtotal: json["line_subtotal"],
        lineSubtotalTax: json["line_subtotal_tax"],
        lineTotal: json["line_total"],
        lineTotalTax: json["line_total_tax"],
    );

    Map<String, dynamic> toJson() => {
        "currency_code": currencyCode,
        "currency_symbol": currencySymbol,
        "currency_minor_unit": currencyMinorUnit,
        "currency_decimal_separator": currencyDecimalSeparator,
        "currency_thousand_separator": currencyThousandSeparator,
        "currency_prefix": currencyPrefix,
        "currency_suffix": currencySuffix,
        "line_subtotal": lineSubtotal,
        "line_subtotal_tax": lineSubtotalTax,
        "line_total": lineTotal,
        "line_total_tax": lineTotalTax,
    };
}

class ShippingAddress {
    ShippingAddress({
        this.firstName,
        this.lastName,
        this.company,
        this.address1,
        this.address2,
        this.city,
        this.state,
        this.postcode,
        this.country,
    });

    String firstName;
    String lastName;
    String company;
    String address1;
    String address2;
    String city;
    String state;
    String postcode;
    String country;

    factory ShippingAddress.fromJson(Map<String, dynamic> json) => ShippingAddress(
        firstName: json["first_name"],
        lastName: json["last_name"],
        company: json["company"],
        address1: json["address_1"],
        address2: json["address_2"],
        city: json["city"],
        state: json["state"],
        postcode: json["postcode"],
        country: json["country"],
    );

    Map<String, dynamic> toJson() => {
        "first_name": firstName,
        "last_name": lastName,
        "company": company,
        "address_1": address1,
        "address_2": address2,
        "city": city,
        "state": state,
        "postcode": postcode,
        "country": country,
    };
}

class WooCartTotals {
    WooCartTotals({
        this.currencyCode,
        this.currencySymbol,
        this.currencyMinorUnit,
        this.currencyDecimalSeparator,
        this.currencyThousandSeparator,
        this.currencyPrefix,
        this.currencySuffix,
        this.totalItems,
        this.totalItemsTax,
        this.totalFees,
        this.totalFeesTax,
        this.totalDiscount,
        this.totalDiscountTax,
        this.totalShipping,
        this.totalShippingTax,
        this.totalPrice,
        this.totalTax,
        this.taxLines,
    });

    String currencyCode;
    String currencySymbol;
    int currencyMinorUnit;
    String currencyDecimalSeparator;
    String currencyThousandSeparator;
    String currencyPrefix;
    String currencySuffix;
    String totalItems;
    String totalItemsTax;
    String totalFees;
    String totalFeesTax;
    String totalDiscount;
    String totalDiscountTax;
    String totalShipping;
    String totalShippingTax;
    String totalPrice;
    String totalTax;
    List<dynamic> taxLines;

    factory WooCartTotals.fromJson(Map<String, dynamic> json) => WooCartTotals(
        currencyCode: json["currency_code"],
        currencySymbol: json["currency_symbol"],
        currencyMinorUnit: json["currency_minor_unit"],
        currencyDecimalSeparator: json["currency_decimal_separator"],
        currencyThousandSeparator: json["currency_thousand_separator"],
        currencyPrefix: json["currency_prefix"],
        currencySuffix: json["currency_suffix"],
        totalItems: json["total_items"],
        totalItemsTax: json["total_items_tax"],
        totalFees: json["total_fees"],
        totalFeesTax: json["total_fees_tax"],
        totalDiscount: json["total_discount"],
        totalDiscountTax: json["total_discount_tax"],
        totalShipping: json["total_shipping"],
        totalShippingTax: json["total_shipping_tax"],
        totalPrice: json["total_price"],
        totalTax: json["total_tax"],
        taxLines: List<dynamic>.from(json["tax_lines"].map((x) => x)),
    );

    Map<String, dynamic> toJson() => {
        "currency_code": currencyCode,
        "currency_symbol": currencySymbol,
        "currency_minor_unit": currencyMinorUnit,
        "currency_decimal_separator": currencyDecimalSeparator,
        "currency_thousand_separator": currencyThousandSeparator,
        "currency_prefix": currencyPrefix,
        "currency_suffix": currencySuffix,
        "total_items": totalItems,
        "total_items_tax": totalItemsTax,
        "total_fees": totalFees,
        "total_fees_tax": totalFeesTax,
        "total_discount": totalDiscount,
        "total_discount_tax": totalDiscountTax,
        "total_shipping": totalShipping,
        "total_shipping_tax": totalShippingTax,
        "total_price": totalPrice,
        "total_tax": totalTax,
        "tax_lines": List<dynamic>.from(taxLines.map((x) => x)),
    };
}

query with auth and security

i am sorry if iam asking some dub question coz iam new to woocommerce ,
thank for this awesome library.

  1. can this be used to login multiple user(consumer)?
  2. can someone read cs_key and cs_secrete?
  3. can someone who has access to this can read and change data of some other user( change cart items and shipping address or change product details)?

i will appreciate your help!!! if u can answer these questions

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.