toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() => <String, dynamic>{
  "id": id,
  "request": request.toJson(),
  "created": createdAt.millisecondsSinceEpoch,
  "status": status.name,
  "received": received,
  "total": total,
  if (fileName != null) "fileName": fileName,
  if (mimeType != null) "mimeType": mimeType,
  if (result != null) "result": result,
  if (partPath != null) "partPath": partPath,
  if (etag != null) "etag": etag,
  if (lastModified != null) "lastModified": lastModified,
  if (acceptsRanges) "ranges": true,
  if (system) "system": true,
  if (mirrorIndex > 0) "mirror": mirrorIndex,
  if (completedAt != null) "completed": completedAt!.millisecondsSinceEpoch,
  if (error != null) "error": error!.toJson(),
  if (segments.isNotEmpty)
    "segments": segments.map((UDownloadSegment s) => <int>[s.start, s.end, max(s.start, durable?.call(s.position) ?? s.position)]).toList(),
};