scanProduct method
Combined scan preview — replaces separate product + price calls.
Implementation
Future<NetworkResponse<ProductScanResult>> scanProduct(String barcode) async {
return _safeCall(() async {
final resp =
await _dio.get('/api/v3/catalog/products/scan/$barcode');
final map = _requireJsonMap(resp.data);
if (map['success'] == false) {
return NetworkError(
_envelopeError(map) ?? 'Product not found',
code: resp.statusCode,
);
}
final data = asJsonMap(map['data']);
if (data == null) {
return NetworkError('Product not found', code: resp.statusCode);
}
return NetworkSuccess(ProductScanResult.fromJson(data));
});
}