getSkuDetails method Null safety
- {required String productCode,
- required int colorId,
- required int sizeId,
- required String switchType,
- int? customerId}
override
It's used when changing the product color or product size.
SwitchType : SwitchColor, SwitchSize
Implementation
@override
Future<ProductDetailsModel> getSkuDetails(
{required String productCode,
required int colorId,
required int sizeId,
required String switchType,
int? customerId}) async {
final response = await postData(path: 'sku/$productCode', queryParameters: {
'CustomerId': customerId,
'colorID': colorId,
'SizeID': sizeId,
'SwitchType': switchType
});
final result = ApiReturnResult.fromJSON(response.data);
if (result.code == 200) {
return ProductDetailsModel.fromJson(result.data);
} else {
throw ExceptionApi(code: result.code, message: result.error?.first);
}
}