Skip to content

Commit d59e16d

Browse files
authored
override operator == and hashCode for DownloadTask (#875)
* override `operator ==` and `hashCode` for `DownloadTask` * bump version to 1.10.7 * remove caching from github actions
1 parent b4f3303 commit d59e16d

File tree

5 files changed

+36
-3
lines changed

5 files changed

+36
-3
lines changed

.github/workflows/prepare.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ jobs:
2323
uses: subosito/flutter-action@v2
2424
with:
2525
flutter-version: ${{ matrix.flutter-version }}
26-
cache: true
2726

2827
- name: flutter pub get
2928
run: flutter pub get

.github/workflows/publish.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ jobs:
2727
uses: subosito/flutter-action@v2
2828
with:
2929
channel: stable
30-
cache: true
3130

3231
- name: Publish to pub.dev
3332
id: pub_release

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.10.7
2+
3+
- Override `operator ==` and `hashCode` for `DownloadTask` (#875)
4+
15
## 1.10.6
26

37
- Fix `delete()` not working when file isn't saved to public storage (#871)

lib/src/models.dart

+31
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,35 @@ class DownloadTask {
8989
@override
9090
String toString() =>
9191
'DownloadTask(taskId: $taskId, status: $status, progress: $progress, url: $url, filename: $filename, savedDir: $savedDir, timeCreated: $timeCreated, allowCellular: $allowCellular)';
92+
93+
@override
94+
bool operator ==(Object other) {
95+
if (identical(this, other)) {
96+
return true;
97+
}
98+
99+
return other is DownloadTask &&
100+
other.taskId == taskId &&
101+
other.status == status &&
102+
other.progress == progress &&
103+
other.url == url &&
104+
other.filename == filename &&
105+
other.savedDir == savedDir &&
106+
other.timeCreated == timeCreated &&
107+
other.allowCellular == allowCellular;
108+
}
109+
110+
@override
111+
int get hashCode {
112+
return Object.hash(
113+
taskId,
114+
status,
115+
progress,
116+
url,
117+
filename,
118+
savedDir,
119+
timeCreated,
120+
allowCellular,
121+
);
122+
}
92123
}

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flutter_downloader
22
description: Powerful plugin making it easy to download files.
3-
version: 1.10.6
3+
version: 1.10.7
44
repository: https://github.com/fluttercommunity/flutter_downloader
55
issue_tracker: https://github.com/fluttercommunity/flutter_downloader/issues
66
maintainer: Bartek Pacia (@bartekpacia)

0 commit comments

Comments
 (0)