getProduct method

Future<ApiCallback<Product>> getProduct(
  1. String productId,
  2. {Seller seller,
  3. bool perSeller = false}
)

endregion region Product API endpoints

Implementation

/// region Product API endpoints

Future<ApiCallback<Product>> getProduct(String productId, {Seller seller, bool perSeller = false}) async {
  try {
    var response = await _requester.get(
      await _catalogEndpoint(API_PRODUCT_BY_ID.replaceAll('%', productId), includeSeller: perSeller),
    );
    return ApiCallback<Product>(isSuccessful: true, resultData: Product.fromJson(response.data));
  } on DioError catch (e) {
    return ApiCallback<Product>().defaultErrorCallback(e);
  }
}