Votes.fromJson constructor

Votes.fromJson(
  1. Map<String, Object?> json
)

Implementation

factory Votes.fromJson(Map<String, Object?> json) {
  return Votes(
    hasVoted: json[r'hasVoted'] as bool? ?? false,
    self: json[r'self'] as String?,
    voters: (json[r'voters'] as List<Object?>?)
            ?.map(
                (i) => User.fromJson(i as Map<String, Object?>? ?? const {}))
            .toList() ??
        [],
    votes: (json[r'votes'] as num?)?.toInt(),
  );
}