fromMap static method

DownloadProcess fromMap(
  1. Map json
)

Implementation

static DownloadProcess fromMap(Map<dynamic, dynamic> json) {
  //获取第一个值
  var status = json["status"] as String;

  return DownloadProcess(
      current: json["current"] as int,
      count: json["count"] as int,
      status: ProcessState.values.firstWhere(
          (element) => element.toString() == "ProcessState.$status"));
}