VoteWitnessContract.fromJson constructor

VoteWitnessContract.fromJson(
  1. Map<String, dynamic> json
)

Create a new VoteWitnessContract instance by parsing a JSON map.

Implementation

factory VoteWitnessContract.fromJson(Map<String, dynamic> json) {
  return VoteWitnessContract(
    ownerAddress: OnChainUtils.parseTronAddress(
        value: json['owner_address'], name: 'owner_address'),
    votes:
        OnChainUtils.parseList<dynamic>(value: json['votes'], name: 'votes')
            ?.map((vote) => VoteWitnessContractVote.fromJson(
                OnChainUtils.parseMap(
                    value: vote, name: 'vote', throwOnNull: true)!))
            .toList(),
    support:
        OnChainUtils.parseBoolean(value: json['support'], name: 'support'),
  );
}