DownloadItem constructor
DownloadItem({
- required int id,
- required String url,
- required String finalUrl,
- required String referrer,
- required String filename,
- required bool incognito,
- required DangerType danger,
- required String mime,
- required String startTime,
- String? endTime,
- String? estimatedEndTime,
- required State state,
- required bool paused,
- required bool canResume,
- InterruptReason? error,
- required double bytesReceived,
- required double totalBytes,
- required double fileSize,
- required bool exists,
- String? byExtensionId,
- String? byExtensionName,
Implementation
DownloadItem({
/// An identifier that is persistent across browser sessions.
required int id,
/// The absolute URL that this download initiated from, before any
/// redirects.
required String url,
/// The absolute URL that this download is being made from, after all
/// redirects.
required String finalUrl,
/// Absolute URL.
required String referrer,
/// Absolute local path.
required String filename,
/// False if this download is recorded in the history, true if it is not
/// recorded.
required bool incognito,
/// Indication of whether this download is thought to be safe or known to be
/// suspicious.
required DangerType danger,
/// The file's MIME type.
required String mime,
/// The time when the download began in ISO 8601 format. May be passed
/// directly to the Date constructor: `chrome.downloads.search({},
/// function(items){items.forEach(function(item){console.log(new
/// Date(item.startTime))})})`
required String startTime,
/// The time when the download ended in ISO 8601 format. May be passed
/// directly to the Date constructor: `chrome.downloads.search({},
/// function(items){items.forEach(function(item){if (item.endTime)
/// console.log(new Date(item.endTime))})})`
String? endTime,
/// Estimated time when the download will complete in ISO 8601 format. May
/// be
/// passed directly to the Date constructor:
/// `chrome.downloads.search({},
/// function(items){items.forEach(function(item){if (item.estimatedEndTime)
/// console.log(new Date(item.estimatedEndTime))})})`
String? estimatedEndTime,
/// Indicates whether the download is progressing, interrupted, or complete.
required State state,
/// True if the download has stopped reading data from the host, but kept
/// the
/// connection open.
required bool paused,
/// True if the download is in progress and paused, or else if it is
/// interrupted and can be resumed starting from where it was interrupted.
required bool canResume,
/// Why the download was interrupted. Several kinds of HTTP errors may be
/// grouped under one of the errors beginning with `SERVER_`.
/// Errors relating to the network begin with `NETWORK_`, errors
/// relating to the process of writing the file to the file system begin
/// with
/// `FILE_`, and interruptions initiated by the user begin with
/// `USER_`.
InterruptReason? error,
/// Number of bytes received so far from the host, without considering file
/// compression.
required double bytesReceived,
/// Number of bytes in the whole file, without considering file compression,
/// or -1 if unknown.
required double totalBytes,
/// Number of bytes in the whole file post-decompression, or -1 if unknown.
required double fileSize,
/// Whether the downloaded file still exists. This information may be out of
/// date because Chrome does not automatically watch for file removal. Call
/// [search]() in order to trigger the check for file existence. When the
/// existence check completes, if the file has been deleted, then an
/// [onChanged] event will fire. Note that [search]() does not wait
/// for the existence check to finish before returning, so results from
/// [search]() may not accurately reflect the file system. Also,
/// [search]() may be called as often as necessary, but will not check for
/// file existence any more frequently than once every 10 seconds.
required bool exists,
/// The identifier for the extension that initiated this download if this
/// download was initiated by an extension. Does not change once it is set.
String? byExtensionId,
/// The localized name of the extension that initiated this download if this
/// download was initiated by an extension. May change if the extension
/// changes its name or if the user changes their locale.
String? byExtensionName,
}) : _wrapped = $js.DownloadItem(
id: id,
url: url,
finalUrl: finalUrl,
referrer: referrer,
filename: filename,
incognito: incognito,
danger: danger.toJS,
mime: mime,
startTime: startTime,
endTime: endTime,
estimatedEndTime: estimatedEndTime,
state: state.toJS,
paused: paused,
canResume: canResume,
error: error?.toJS,
bytesReceived: bytesReceived,
totalBytes: totalBytes,
fileSize: fileSize,
exists: exists,
byExtensionId: byExtensionId,
byExtensionName: byExtensionName,
);