AccountRequirements.fromJson constructor

AccountRequirements.fromJson(
  1. Object? json
)

Implementation

factory AccountRequirements.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return AccountRequirements(
    alternatives: map['alternatives'] == null
        ? null
        : (map['alternatives'] as List<Object?>)
            .map((el) => AccountRequirementsAlternative.fromJson(el))
            .toList(),
    currentDeadline: map['current_deadline'] == null
        ? null
        : DateTime.fromMillisecondsSinceEpoch(
            (map['current_deadline'] as int).toInt()),
    currentlyDue: map['currently_due'] == null
        ? null
        : (map['currently_due'] as List<Object?>)
            .map((el) => (el as String))
            .toList(),
    disabledReason: map['disabled_reason'] == null
        ? null
        : (map['disabled_reason'] as String),
    errors: map['errors'] == null
        ? null
        : (map['errors'] as List<Object?>)
            .map((el) => AccountRequirementsError.fromJson(el))
            .toList(),
    eventuallyDue: map['eventually_due'] == null
        ? null
        : (map['eventually_due'] as List<Object?>)
            .map((el) => (el as String))
            .toList(),
    pastDue: map['past_due'] == null
        ? null
        : (map['past_due'] as List<Object?>)
            .map((el) => (el as String))
            .toList(),
    pendingVerification: map['pending_verification'] == null
        ? null
        : (map['pending_verification'] as List<Object?>)
            .map((el) => (el as String))
            .toList(),
  );
}