BillingPortalConfiguration.fromJson constructor

BillingPortalConfiguration.fromJson(
  1. Object? json
)

Implementation

factory BillingPortalConfiguration.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return BillingPortalConfiguration(
    active: (map['active'] as bool),
    application: map['application'] == null
        ? null
        : BillingPortalConfigurationApplicationOrId.fromJson(
            map['application']),
    businessProfile: PortalBusinessProfile.fromJson(map['business_profile']),
    created:
        DateTime.fromMillisecondsSinceEpoch((map['created'] as int).toInt()),
    defaultReturnUrl: map['default_return_url'] == null
        ? null
        : (map['default_return_url'] as String),
    features: PortalFeatures.fromJson(map['features']),
    id: (map['id'] as String),
    isDefault: (map['is_default'] as bool),
    livemode: (map['livemode'] as bool),
    loginPage: PortalLoginPage.fromJson(map['login_page']),
    metadata: map['metadata'] == null
        ? null
        : (map['metadata'] as Map).cast<String, Object?>().map((
              key,
              value,
            ) =>
                MapEntry(
                  key,
                  (value as String),
                )),
    updated:
        DateTime.fromMillisecondsSinceEpoch((map['updated'] as int).toInt()),
  );
}