DownloadProgress.fromBytes constructor
DownloadProgress.fromBytes({})
Creates a DownloadProgress instance from bytes
Implementation
factory DownloadProgress.fromBytes({
required int totalBytes,
required int downloadedBytes,
double? speed,
}) {
final percentage =
totalBytes > 0 ? (downloadedBytes / totalBytes) * 100 : 0.0;
return DownloadProgress(
totalBytes: totalBytes,
downloadedBytes: downloadedBytes,
percentage: percentage,
speed: speed,
);
}