fromJson static method

UpdateTenantPackageBody? fromJson(
  1. dynamic value
)

Returns a new UpdateTenantPackageBody instance and imports its values from value if it's a Map, null otherwise.

Implementation

// ignore: prefer_constructors_over_static_methods
static UpdateTenantPackageBody? fromJson(dynamic value) {
  if (value is Map) {
    final json = value.cast<String, dynamic>();

    // Ensure that the map contains the required keys.
    // Note 1: the values aren't checked for validity beyond being non-null.
    // Note 2: this code is stripped in release mode!
    assert(() {
      return true;
    }());

    return UpdateTenantPackageBody(
      name: mapValueOfType<String>(json, r'name'),
      monthlyCostUSD: mapValueOfType<double>(json, r'monthlyCostUSD'),
      yearlyCostUSD: mapValueOfType<double>(json, r'yearlyCostUSD'),
      maxMonthlyPageLoads: mapValueOfType<double>(json, r'maxMonthlyPageLoads'),
      maxMonthlyAPICredits: mapValueOfType<double>(json, r'maxMonthlyAPICredits'),
      maxMonthlyComments: mapValueOfType<double>(json, r'maxMonthlyComments'),
      maxConcurrentUsers: mapValueOfType<double>(json, r'maxConcurrentUsers'),
      maxTenantUsers: mapValueOfType<double>(json, r'maxTenantUsers'),
      maxSSOUsers: mapValueOfType<double>(json, r'maxSSOUsers'),
      maxModerators: mapValueOfType<double>(json, r'maxModerators'),
      maxDomains: mapValueOfType<double>(json, r'maxDomains'),
      maxCustomCollectionSize: mapValueOfType<double>(json, r'maxCustomCollectionSize'),
      hasDebranding: mapValueOfType<bool>(json, r'hasDebranding'),
      hasWhiteLabeling: mapValueOfType<bool>(json, r'hasWhiteLabeling'),
      forWhoText: mapValueOfType<String>(json, r'forWhoText'),
      featureTaglines: json[r'featureTaglines'] is Iterable
          ? (json[r'featureTaglines'] as Iterable).cast<String>().toList(growable: false)
          : const [],
      hasFlexPricing: mapValueOfType<bool>(json, r'hasFlexPricing'),
      flexPageLoadCostCents: mapValueOfType<double>(json, r'flexPageLoadCostCents'),
      flexPageLoadUnit: mapValueOfType<double>(json, r'flexPageLoadUnit'),
      flexCommentCostCents: mapValueOfType<double>(json, r'flexCommentCostCents'),
      flexCommentUnit: mapValueOfType<double>(json, r'flexCommentUnit'),
      flexSSOUserCostCents: mapValueOfType<double>(json, r'flexSSOUserCostCents'),
      flexSSOUserUnit: mapValueOfType<double>(json, r'flexSSOUserUnit'),
      flexAPICreditCostCents: mapValueOfType<double>(json, r'flexAPICreditCostCents'),
      flexAPICreditUnit: mapValueOfType<double>(json, r'flexAPICreditUnit'),
      flexModeratorCostCents: mapValueOfType<double>(json, r'flexModeratorCostCents'),
      flexModeratorUnit: mapValueOfType<double>(json, r'flexModeratorUnit'),
      flexAdminCostCents: mapValueOfType<double>(json, r'flexAdminCostCents'),
      flexAdminUnit: mapValueOfType<double>(json, r'flexAdminUnit'),
      flexDomainCostCents: mapValueOfType<double>(json, r'flexDomainCostCents'),
      flexDomainUnit: mapValueOfType<double>(json, r'flexDomainUnit'),
      flexMinimumCostCents: mapValueOfType<double>(json, r'flexMinimumCostCents'),
    );
  }
  return null;
}