Project.fromJson constructor

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

Implementation

factory Project.fromJson(Map<String, dynamic> json) => Project(
      id: Hash.parse(json['id']),
      owner: Address.parse(json['owner']),
      name: json['name'],
      description: json['description'],
      url: json['url'],
      znnFundsNeeded: json['znnFundsNeeded'],
      qsrFundsNeeded: json['qsrFundsNeeded'],
      creationTimestamp: json['creationTimestamp'],
      lastUpdateTimestamp: json['lastUpdateTimestamp'],
      status: json['status'],
      voteBreakdown: VoteBreakdown.fromJson(json['votes']),
      phases: (json['phases'] as List).fold<List<Phase>>([],
          (previousValue, element) {
        previousValue.add(Phase.fromJson(element));
        return previousValue;
      }),
      phaseIds: (json['phaseIds'] as List).fold<List<Hash>>([],
          (previousValue, element) {
        previousValue.add(Hash.parse(element));
        return previousValue;
      }),
    );