Account.fromJson constructor
Account.fromJson(
- Object? json
Implementation
factory Account.fromJson(Object? json) {
final map = (json as Map).cast<String, Object?>();
return Account(
businessProfile: map['business_profile'] == null
? null
: AccountBusinessProfile.fromJson(map['business_profile']),
businessType: map['business_type'] == null
? null
: AccountBusinessType.fromJson(map['business_type']),
capabilities: map['capabilities'] == null
? null
: AccountCapabilities.fromJson(map['capabilities']),
chargesEnabled: map['charges_enabled'] == null
? null
: (map['charges_enabled'] as bool),
company: map['company'] == null
? null
: LegalEntityCompany.fromJson(map['company']),
controller: map['controller'] == null
? null
: AccountUnificationAccountController.fromJson(map['controller']),
country: map['country'] == null ? null : (map['country'] as String),
created: map['created'] == null
? null
: DateTime.fromMillisecondsSinceEpoch(
(map['created'] as int).toInt()),
defaultCurrency: map['default_currency'] == null
? null
: (map['default_currency'] as String),
detailsSubmitted: map['details_submitted'] == null
? null
: (map['details_submitted'] as bool),
email: map['email'] == null ? null : (map['email'] as String),
externalAccounts: map['external_accounts'] == null
? null
: AccountExternalAccounts.fromJson(map['external_accounts']),
futureRequirements: map['future_requirements'] == null
? null
: AccountFutureRequirements.fromJson(map['future_requirements']),
id: (map['id'] as String),
individual:
map['individual'] == null ? null : Person.fromJson(map['individual']),
metadata: map['metadata'] == null
? null
: (map['metadata'] as Map).cast<String, Object?>().map((
key,
value,
) =>
MapEntry(
key,
(value as String),
)),
payoutsEnabled: map['payouts_enabled'] == null
? null
: (map['payouts_enabled'] as bool),
requirements: map['requirements'] == null
? null
: AccountRequirements.fromJson(map['requirements']),
settings: map['settings'] == null
? null
: AccountSettings.fromJson(map['settings']),
tosAcceptance: map['tos_acceptance'] == null
? null
: AccountTosAcceptance.fromJson(map['tos_acceptance']),
type: map['type'] == null ? null : AccountType.fromJson(map['type']),
);
}