@ -11,17 +11,14 @@ import '../../../locator.dart';
class ProductDetailViewModel extends BaseViewModel {
ProductDetailService _productDetailService = locator < ProductDetailService > ( ) ;
ProductDetailService _productLocationService = locator < ProductDetailService > ( ) ;
ProductDetailService _productWishlistService = locator < ProductDetailService > ( ) ;
ProductDetailService _productSpecification = locator < ProductDetailService > ( ) ;
List < ProductDetail > get productDetailService = > _productDetailService . productDetailList ;
List < LocationModel > get productLocationService = > _product Location Service. productLocationList ;
List < LocationModel > get productLocationService = > _product Detail Service. productLocationList ;
List < Wishlist > get wishListItems = > _product Wishlist Service. wishListProducts ;
List < Wishlist > get wishListItems = > _product Detail Service. wishListProducts ;
List < SpecificationModel > get productSpecification = > _product Specification . productSpecification ;
List < SpecificationModel > get productSpecification = > _product DetailService . productSpecification ;
bool hasError = false ;
@ -42,9 +39,9 @@ class ProductDetailViewModel extends BaseViewModel{
print ( ' ENAD in model view ' ) ;
hasError = false ;
setState ( ViewState . Busy ) ;
await _product Location Service. getProductAvailabiltyDetail ( ) ;
if ( _product Location Service. hasError ) {
error = _product Location Service. error ;
await _product Detail Service. getProductAvailabiltyDetail ( ) ;
if ( _product Detail Service. hasError ) {
error = _product Detail Service. error ;
setState ( ViewState . ErrorLocal ) ;
} else
setState ( ViewState . Idle ) ;
@ -53,9 +50,9 @@ class ProductDetailViewModel extends BaseViewModel{
Future notifyMe ( customerId , itemID ) async {
hasError = false ;
setState ( ViewState . Busy ) ;
await _product Location Service. notifyMe ( customerId , itemID ) ;
if ( _product Location Service. hasError ) {
error = _product Location Service. error ;
await _product Detail Service. notifyMe ( customerId , itemID ) ;
if ( _product Detail Service. hasError ) {
error = _product Detail Service. error ;
setState ( ViewState . ErrorLocal ) ;
} else
setState ( ViewState . Idle ) ;
@ -64,9 +61,9 @@ class ProductDetailViewModel extends BaseViewModel{
Future addToCartData ( quantity , itemID ) async {
hasError = false ;
setState ( ViewState . Busy ) ;
await _product Location Service. addToCart ( quantity , itemID ) ;
if ( _product Location Service. hasError ) {
error = _product Location Service. error ;
await _product Detail Service. addToCart ( quantity , itemID ) ;
if ( _product Detail Service. hasError ) {
error = _product Detail Service. error ;
setState ( ViewState . ErrorLocal ) ;
} else
setState ( ViewState . Idle ) ;
@ -75,9 +72,9 @@ class ProductDetailViewModel extends BaseViewModel{
Future addToWishlistData ( itemID ) async {
hasError = false ;
setState ( ViewState . Busy ) ;
await _product Location Service. addToWishlist ( itemID ) ;
if ( _product Location Service. hasError ) {
error = _product Location Service. error ;
await _product Detail Service. addToWishlist ( itemID ) ;
if ( _product Detail Service. hasError ) {
error = _product Detail Service. error ;
setState ( ViewState . ErrorLocal ) ;
} else
setState ( ViewState . Idle ) ;
@ -86,9 +83,9 @@ class ProductDetailViewModel extends BaseViewModel{
Future checkWishlistData ( ) async {
hasError = false ;
setState ( ViewState . Busy ) ;
await _product Wishlist Service. getWishlistItems ( ) ;
if ( _product Wishlist Service. hasError ) {
error = _product Wishlist Service. error ;
await _product Detail Service. getWishlistItems ( ) ;
if ( _product Detail Service. hasError ) {
error = _product Detail Service. error ;
setState ( ViewState . ErrorLocal ) ;
} else
setState ( ViewState . Idle ) ;
@ -98,9 +95,9 @@ class ProductDetailViewModel extends BaseViewModel{
Future deletWishlistData ( itemID ) async {
hasError = false ;
setState ( ViewState . Busy ) ;
await _product Wishlist Service. delteItemFromWishlist ( itemID ) ;
if ( _product Wishlist Service. hasError ) {
error = _product Wishlist Service. error ;
await _product Detail Service. delteItemFromWishlist ( itemID ) ;
if ( _product Detail Service. hasError ) {
error = _product Detail Service. error ;
setState ( ViewState . ErrorLocal ) ;
} else
setState ( ViewState . Idle ) ;
@ -110,9 +107,9 @@ class ProductDetailViewModel extends BaseViewModel{
Future productSpecificationData ( itemID ) async {
hasError = false ;
setState ( ViewState . Busy ) ;
await _product Wishlist Service. productSpecificationData ( itemID ) ;
if ( _product Wishlist Service. hasError ) {
error = _product Wishlist Service. error ;
await _product Detail Service. productSpecificationData ( itemID ) ;
if ( _product Detail Service. hasError ) {
error = _product Detail Service. error ;
setState ( ViewState . ErrorLocal ) ;
} else
setState ( ViewState . Idle ) ;