Permission.fromJson constructor

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

Create a new Permission instance by parsing a JSON map.

Implementation

factory Permission.fromJson(Map<String, dynamic> json) {
  return Permission(
      type: PermissionType.fromName(
          OnChainUtils.parseString(value: json["type"], name: "type"),
          defaultPermission: PermissionType.owner),
      id: OnChainUtils.parseInt(value: json["id"], name: "id"),
      permissionName: OnChainUtils.parseString(
          value: json["permission_name"], name: "permission_name"),
      operations: OnChainUtils.parseHex(
          value: json["operations"], name: "operations"),
      keys: OnChainUtils.parseList(value: json["keys"], name: "keys")
          ?.map((e) => TronKey.fromJson(e))
          .toList(),
      parentId:
          OnChainUtils.parseInt(value: json["parent_id"], name: "parent_id"),
      threshold: OnChainUtils.parseBigInt(
          value: json["threshold"], name: "threshold"));
}