TransferCreateOptions.fromJson constructor

TransferCreateOptions.fromJson(
  1. Object? json
)

Implementation

factory TransferCreateOptions.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return TransferCreateOptions(
    amount: map['amount'] == null ? null : (map['amount'] as num).toInt(),
    currency: (map['currency'] as String),
    description:
        map['description'] == null ? null : (map['description'] as String),
    destination: (map['destination'] as String),
    expand: map['expand'] == null
        ? null
        : (map['expand'] as List<Object?>)
            .map((el) => (el as String))
            .toList(),
    metadata: map['metadata'] == null
        ? null
        : (map['metadata'] as Map).cast<String, Object?>().map((
              key,
              value,
            ) =>
                MapEntry(
                  key,
                  (value as String),
                )),
    sourceTransaction: map['source_transaction'] == null
        ? null
        : (map['source_transaction'] as String),
    sourceType: map['source_type'] == null
        ? null
        : PayoutSourceType.fromJson(map['source_type']),
    transferGroup: map['transfer_group'] == null
        ? null
        : (map['transfer_group'] as String),
  );
}