searchPrice method
Implementation
Future<NetworkResponse<ProductPriceInfo>> searchPrice(
String barcode, {
required String merchantId,
required String outletId,
}) async {
return _safeCall(() async {
final resp = await _dio.get(
'/search/product/price/$barcode',
queryParameters: {
'merchantId': merchantId,
'outletId': outletId,
'isMemberLogin': 'false',
},
);
final empty =
_emptyBodyError<ProductPriceInfo>(resp, 'Price not found for this product');
if (empty != null) return empty;
final json = asJsonMap(resp.data);
if (json == null) {
return NetworkError(
'Price not found for this product',
code: resp.statusCode,
);
}
return NetworkSuccess(ProductPriceInfo.fromJson(json));
});
}