WooSignalApp.fromJson constructor
WooSignalApp.fromJson(
- Map<String, dynamic> json
)
Implementation
WooSignalApp.fromJson(Map<String, dynamic> json) {
appName = json['app_name'];
appLogo = json['app_logo'];
appTermsLink = json['app_termslink'];
appPrivacyLink = json['app_privacylink'];
appDebug = json['app_debug'];
appStatus = json['app_status'];
currencyMeta = json['currency_meta'] != null
? CurrencyMeta.fromJson(json['currency_meta'])
: null;
bannerImages = json['banner_images'].cast<String>();
stripeLiveMode = json['stripe_live_mode'];
stripeAccount = json['stripe_account'];
wpLoginEnabled = json['wp_login_enabled'];
if (json['wishlist_enabled'] is int && json['wishlist_enabled'] == 1) {
wishlistEnabled = true;
} else {
wishlistEnabled = false;
}
if (json['coupon_enabled'] is int && json['coupon_enabled'] == 1) {
couponEnabled = true;
} else {
couponEnabled = false;
}
if (json['show_product_reviews'] is int &&
json['show_product_reviews'] == 1) {
showProductReviews = true;
} else {
showProductReviews = false;
}
if (json['show_related_products'] is int &&
json['show_related_products'] == 1) {
showRelatedProducts = true;
} else {
showRelatedProducts = false;
}
if (json['show_upsell_products'] is int &&
json['show_upsell_products'] == 1) {
showUpsellProducts = true;
} else {
showUpsellProducts = false;
}
if (json['collections'] != null) {
productCategoryCollections = List.from(json['collections'])
.map((collection) => ProductCategoryCollection.fromJson(collection))
.toList();
}
wpLoginBaseUrl = json['wp_login_base_url'];
wpLoginForgotPasswordUrl = json['wp_login_forgot_password_url'];
wpLoginWpApiPath = json['wp_login_wp_api_path'];
productPricesIncludeTax = json['product_prices_include_tax'];
disableShipping = json['disable_shipping'];
theme = json['theme'];
locale = json['locale'];
paypalLocale = json['paypal_locale'] ?? "en-GB";
paypalEmail = json['paypal_email'] ?? "";
stripeEnabled = (json['stripe_enabled'] ?? 0) == 1 ? true : false;
codEnabled = (json['cod_enabled'] ?? 0) == 1 ? true : false;
paypalEnabled = (json['paypal_enabled'] ?? 0) == 1 ? true : false;
paypalLiveMode = (json['paypal_live_mode'] ?? 0) == 1 ? true : false;
stripeCountryCode = json['stripe_country_code'] ?? "GB";
if (json.containsKey('theme_font') && json['theme_font'] != null) {
themeFont = json['theme_font'];
}
if (json.containsKey('social_links') &&
json['social_links'] is Map<String, dynamic>?) {
socialLinks = json['social_links'];
}
if (json.containsKey('theme_colors') &&
json['theme_colors'] is Map<String, dynamic>?) {
themeColors = json['theme_colors'];
}
if (json.containsKey('firebase_config') &&
json['firebase_config'] is Map<String, dynamic>?) {
Map<String, dynamic> firebaseConfig = json['firebase_config'];
if (firebaseConfig.containsKey('firebase_options_ios') &&
firebaseConfig['firebase_options_ios'] != null) {
firebaseOptionsIos = firebaseConfig['firebase_options_ios'];
}
if (firebaseConfig.containsKey('firebase_options_android') &&
firebaseConfig['firebase_options_android'] != null) {
firebaseOptionsAndroid = firebaseConfig['firebase_options_android'];
}
}
if (json['firebase_fcm_enabled'] != null) {
firebaseFcmIsEnabled =
json['firebase_fcm_enabled'].toString() == "1" ? true : false;
}
if (json.containsKey('menu_links')) {
menuLinks = List.from(json['menu_links'])
.map((bet) => MenuLink.fromJson(bet))
.toList();
}
}