import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/models/pharmacy/locationModel.dart'; import 'package:diplomaticquarterapp/models/pharmacy/productDetailModel.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; class ProductDetailService extends BaseService { AppSharedPreferences sharedPref = AppSharedPreferences(); bool isLogin = false; List _productDetailList = List(); List get productDetailList => _productDetailList; List _productLocationList = List(); List get productLocationList => _productLocationList; Future getProductReviews() async { hasError = false; await baseAppClient.getPharmacy(GET_PRODUCT_DETAIL+"1480?fields=reviews", onSuccess: (dynamic response, int statusCode) { _productDetailList.clear(); response['products'].forEach((item) { _productDetailList.add(ProductDetail.fromJson(item)); print(response); }); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }); } Future getProductAvailabiltyDetail() async { hasError = false; Map request; request = { "Channel": 3, "DeviceTypeID": 2, "IPAdress": "10.20.10.20", "LanguageID": 2, "PatientOutSA": 0, "SKU": "6720020025", "SessionID": null, "VersionID": 5.6, "generalid": "Cs2020@2016\$2958", "isDentalAllowedBackend": false }; await baseAppClient.post(GET_LOCATION, onSuccess: (dynamic response, int statusCode) { _productLocationList.clear(); response['PharmList'].forEach((item) { _productLocationList.add(LocationModel.fromJson(item)); }); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: request); } }