Capability.fromJson constructor

Capability.fromJson(
  1. Object? json
)

Implementation

factory Capability.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return Capability(
    account: AccountOrId.fromJson(map['account']),
    futureRequirements: map['future_requirements'] == null
        ? null
        : AccountCapabilityFutureRequirements.fromJson(
            map['future_requirements']),
    id: (map['id'] as String),
    requested: (map['requested'] as bool),
    requestedAt: map['requested_at'] == null
        ? null
        : DateTime.fromMillisecondsSinceEpoch(
            (map['requested_at'] as int).toInt()),
    requirements: map['requirements'] == null
        ? null
        : AccountCapabilityRequirements.fromJson(map['requirements']),
    status: CapabilityStatus.fromJson(map['status']),
  );
}