VoteAssetContract.fromJson constructor

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

Create a new VoteAssetContract instance by parsing a JSON map.

Implementation

factory VoteAssetContract.fromJson(Map<String, dynamic> json) {
  return VoteAssetContract(
    ownerAddress: OnChainUtils.parseTronAddress(
        value: json["owner_address"], name: "owner_address"),
    voteAddress: OnChainUtils.parseList<String>(
            value: json["vote_address"],
            name: "vote_address",
            throwOnNull: true)!
        .map((address) => TronAddress(address))
        .toList(),
    support:
        OnChainUtils.parseBoolean(value: json['support'], name: "support"),
    count: OnChainUtils.parseInt(value: json['count'], name: "count"),
  );
}