fromJson static method
Returns a new TenantPackage instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static TenantPackage? 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(() {
assert(json.containsKey(r'_id'), 'Required key "TenantPackage[_id]" is missing from JSON.');
assert(json[r'_id'] != null, 'Required key "TenantPackage[_id]" has a null value in JSON.');
assert(json.containsKey(r'name'), 'Required key "TenantPackage[name]" is missing from JSON.');
assert(json[r'name'] != null, 'Required key "TenantPackage[name]" has a null value in JSON.');
assert(json.containsKey(r'tenantId'), 'Required key "TenantPackage[tenantId]" is missing from JSON.');
assert(json[r'tenantId'] != null, 'Required key "TenantPackage[tenantId]" has a null value in JSON.');
assert(json.containsKey(r'createdAt'), 'Required key "TenantPackage[createdAt]" is missing from JSON.');
assert(json[r'createdAt'] != null, 'Required key "TenantPackage[createdAt]" has a null value in JSON.');
assert(json.containsKey(r'monthlyCostUSD'), 'Required key "TenantPackage[monthlyCostUSD]" is missing from JSON.');
assert(json.containsKey(r'yearlyCostUSD'), 'Required key "TenantPackage[yearlyCostUSD]" is missing from JSON.');
assert(json.containsKey(r'monthlyStripePlanId'), 'Required key "TenantPackage[monthlyStripePlanId]" is missing from JSON.');
assert(json.containsKey(r'yearlyStripePlanId'), 'Required key "TenantPackage[yearlyStripePlanId]" is missing from JSON.');
assert(json.containsKey(r'maxMonthlyPageLoads'), 'Required key "TenantPackage[maxMonthlyPageLoads]" is missing from JSON.');
assert(json[r'maxMonthlyPageLoads'] != null, 'Required key "TenantPackage[maxMonthlyPageLoads]" has a null value in JSON.');
assert(json.containsKey(r'maxMonthlyAPICredits'), 'Required key "TenantPackage[maxMonthlyAPICredits]" is missing from JSON.');
assert(json[r'maxMonthlyAPICredits'] != null, 'Required key "TenantPackage[maxMonthlyAPICredits]" has a null value in JSON.');
assert(json.containsKey(r'maxMonthlySmallWidgetsCredits'), 'Required key "TenantPackage[maxMonthlySmallWidgetsCredits]" is missing from JSON.');
assert(json[r'maxMonthlySmallWidgetsCredits'] != null, 'Required key "TenantPackage[maxMonthlySmallWidgetsCredits]" has a null value in JSON.');
assert(json.containsKey(r'maxMonthlyComments'), 'Required key "TenantPackage[maxMonthlyComments]" is missing from JSON.');
assert(json[r'maxMonthlyComments'] != null, 'Required key "TenantPackage[maxMonthlyComments]" has a null value in JSON.');
assert(json.containsKey(r'maxConcurrentUsers'), 'Required key "TenantPackage[maxConcurrentUsers]" is missing from JSON.');
assert(json[r'maxConcurrentUsers'] != null, 'Required key "TenantPackage[maxConcurrentUsers]" has a null value in JSON.');
assert(json.containsKey(r'maxTenantUsers'), 'Required key "TenantPackage[maxTenantUsers]" is missing from JSON.');
assert(json[r'maxTenantUsers'] != null, 'Required key "TenantPackage[maxTenantUsers]" has a null value in JSON.');
assert(json.containsKey(r'maxSSOUsers'), 'Required key "TenantPackage[maxSSOUsers]" is missing from JSON.');
assert(json[r'maxSSOUsers'] != null, 'Required key "TenantPackage[maxSSOUsers]" has a null value in JSON.');
assert(json.containsKey(r'maxModerators'), 'Required key "TenantPackage[maxModerators]" is missing from JSON.');
assert(json[r'maxModerators'] != null, 'Required key "TenantPackage[maxModerators]" has a null value in JSON.');
assert(json.containsKey(r'maxDomains'), 'Required key "TenantPackage[maxDomains]" is missing from JSON.');
assert(json[r'maxDomains'] != null, 'Required key "TenantPackage[maxDomains]" has a null value in JSON.');
assert(json.containsKey(r'maxWhiteLabeledTenants'), 'Required key "TenantPackage[maxWhiteLabeledTenants]" is missing from JSON.');
assert(json[r'maxWhiteLabeledTenants'] != null, 'Required key "TenantPackage[maxWhiteLabeledTenants]" has a null value in JSON.');
assert(json.containsKey(r'maxMonthlyEventLogRequests'), 'Required key "TenantPackage[maxMonthlyEventLogRequests]" is missing from JSON.');
assert(json[r'maxMonthlyEventLogRequests'] != null, 'Required key "TenantPackage[maxMonthlyEventLogRequests]" has a null value in JSON.');
assert(json.containsKey(r'maxCustomCollectionSize'), 'Required key "TenantPackage[maxCustomCollectionSize]" is missing from JSON.');
assert(json[r'maxCustomCollectionSize'] != null, 'Required key "TenantPackage[maxCustomCollectionSize]" has a null value in JSON.');
assert(json.containsKey(r'hasWhiteLabeling'), 'Required key "TenantPackage[hasWhiteLabeling]" is missing from JSON.');
assert(json[r'hasWhiteLabeling'] != null, 'Required key "TenantPackage[hasWhiteLabeling]" has a null value in JSON.');
assert(json.containsKey(r'hasDebranding'), 'Required key "TenantPackage[hasDebranding]" is missing from JSON.');
assert(json[r'hasDebranding'] != null, 'Required key "TenantPackage[hasDebranding]" has a null value in JSON.');
assert(json.containsKey(r'hasLLMSpamDetection'), 'Required key "TenantPackage[hasLLMSpamDetection]" is missing from JSON.');
assert(json[r'hasLLMSpamDetection'] != null, 'Required key "TenantPackage[hasLLMSpamDetection]" has a null value in JSON.');
assert(json.containsKey(r'forWhoText'), 'Required key "TenantPackage[forWhoText]" is missing from JSON.');
assert(json[r'forWhoText'] != null, 'Required key "TenantPackage[forWhoText]" has a null value in JSON.');
assert(json.containsKey(r'featureTaglines'), 'Required key "TenantPackage[featureTaglines]" is missing from JSON.');
assert(json[r'featureTaglines'] != null, 'Required key "TenantPackage[featureTaglines]" has a null value in JSON.');
assert(json.containsKey(r'hasAuditing'), 'Required key "TenantPackage[hasAuditing]" is missing from JSON.');
assert(json[r'hasAuditing'] != null, 'Required key "TenantPackage[hasAuditing]" has a null value in JSON.');
assert(json.containsKey(r'hasFlexPricing'), 'Required key "TenantPackage[hasFlexPricing]" is missing from JSON.');
assert(json[r'hasFlexPricing'] != null, 'Required key "TenantPackage[hasFlexPricing]" has a null value in JSON.');
return true;
}());
return TenantPackage(
id: mapValueOfType<String>(json, r'_id')!,
name: mapValueOfType<String>(json, r'name')!,
tenantId: mapValueOfType<String>(json, r'tenantId')!,
createdAt: mapDateTime(json, r'createdAt', r'')!,
templateId: mapValueOfType<String>(json, r'templateId'),
monthlyCostUSD: mapValueOfType<double>(json, r'monthlyCostUSD'),
yearlyCostUSD: mapValueOfType<double>(json, r'yearlyCostUSD'),
monthlyStripePlanId: mapValueOfType<String>(json, r'monthlyStripePlanId'),
yearlyStripePlanId: mapValueOfType<String>(json, r'yearlyStripePlanId'),
maxMonthlyPageLoads: mapValueOfType<double>(json, r'maxMonthlyPageLoads')!,
maxMonthlyAPICredits: mapValueOfType<double>(json, r'maxMonthlyAPICredits')!,
maxMonthlySmallWidgetsCredits: mapValueOfType<double>(json, r'maxMonthlySmallWidgetsCredits')!,
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')!,
maxWhiteLabeledTenants: mapValueOfType<double>(json, r'maxWhiteLabeledTenants')!,
maxMonthlyEventLogRequests: mapValueOfType<double>(json, r'maxMonthlyEventLogRequests')!,
maxCustomCollectionSize: mapValueOfType<double>(json, r'maxCustomCollectionSize')!,
hasWhiteLabeling: mapValueOfType<bool>(json, r'hasWhiteLabeling')!,
hasDebranding: mapValueOfType<bool>(json, r'hasDebranding')!,
hasLLMSpamDetection: mapValueOfType<bool>(json, r'hasLLMSpamDetection')!,
forWhoText: mapValueOfType<String>(json, r'forWhoText')!,
featureTaglines: json[r'featureTaglines'] is Iterable
? (json[r'featureTaglines'] as Iterable).cast<String>().toList(growable: false)
: const [],
hasAuditing: mapValueOfType<bool>(json, r'hasAuditing')!,
hasFlexPricing: mapValueOfType<bool>(json, r'hasFlexPricing')!,
enableSAML: mapValueOfType<bool>(json, r'enableSAML'),
enableCanvasLTI: mapValueOfType<bool>(json, r'enableCanvasLTI'),
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'),
flexSmallWidgetsCreditCostCents: mapValueOfType<double>(json, r'flexSmallWidgetsCreditCostCents'),
flexSmallWidgetsCreditUnit: mapValueOfType<double>(json, r'flexSmallWidgetsCreditUnit'),
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'),
flexChatGPTCostCents: mapValueOfType<double>(json, r'flexChatGPTCostCents'),
flexChatGPTUnit: mapValueOfType<double>(json, r'flexChatGPTUnit'),
flexLLMCostCents: mapValueOfType<double>(json, r'flexLLMCostCents'),
flexLLMUnit: mapValueOfType<double>(json, r'flexLLMUnit'),
flexMinimumCostCents: mapValueOfType<double>(json, r'flexMinimumCostCents'),
flexManagedTenantCostCents: mapValueOfType<double>(json, r'flexManagedTenantCostCents'),
flexSSOAdminCostCents: mapValueOfType<double>(json, r'flexSSOAdminCostCents'),
flexSSOAdminUnit: mapValueOfType<double>(json, r'flexSSOAdminUnit'),
flexSSOModeratorCostCents: mapValueOfType<double>(json, r'flexSSOModeratorCostCents'),
flexSSOModeratorUnit: mapValueOfType<double>(json, r'flexSSOModeratorUnit'),
isSSOBillingMonthlyActiveUsers: mapValueOfType<bool>(json, r'isSSOBillingMonthlyActiveUsers'),
hasAIAgents: mapValueOfType<bool>(json, r'hasAIAgents'),
maxAIAgents: mapValueOfType<double>(json, r'maxAIAgents'),
aiAgentDailyBudgetCents: mapValueOfType<double>(json, r'aiAgentDailyBudgetCents'),
aiAgentMonthlyBudgetCents: mapValueOfType<double>(json, r'aiAgentMonthlyBudgetCents'),
);
}
return null;
}