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) {
  final ownerAddress = TronAddress(json['owner_address']);
  final votes = (json['votes'] as List?)
      ?.map((vote) => VoteWitnessContractVote.fromJson(vote))
      .toList();
  final support = json['support'];

  return VoteWitnessContract(
    ownerAddress: ownerAddress,
    votes: votes,
    support: support,
  );
}