getProductById method

Future<WooProduct> getProductById({
  1. required int id,
})

Returns a WooProduct, with the specified id.

Implementation

Future<WooProduct> getProductById({required int id}) async {
  WooProduct product;
  _setApiResourceUrl(
    path: 'products/' + id.toString(),
  );
  final response = await get(queryUri.toString());
  product = WooProduct.fromJson(response);
  return product;
}