Skip to content

Commit

Permalink
override operator == and hashCode for DownloadTask (#875)
Browse files Browse the repository at this point in the history
* override `operator ==` and `hashCode` for `DownloadTask`

* bump version to 1.10.7

* remove caching from github actions
  • Loading branch information
bartekpacia authored Jul 30, 2023
1 parent b4f3303 commit d59e16d
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 3 deletions.
1 change: 0 additions & 1 deletion .github/workflows/prepare.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ jobs:
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ matrix.flutter-version }}
cache: true

- name: flutter pub get
run: flutter pub get
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ jobs:
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true

- name: Publish to pub.dev
id: pub_release
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.10.7

- Override `operator ==` and `hashCode` for `DownloadTask` (#875)

## 1.10.6

- Fix `delete()` not working when file isn't saved to public storage (#871)
Expand Down
31 changes: 31 additions & 0 deletions lib/src/models.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,35 @@ class DownloadTask {
@override
String toString() =>
'DownloadTask(taskId: $taskId, status: $status, progress: $progress, url: $url, filename: $filename, savedDir: $savedDir, timeCreated: $timeCreated, allowCellular: $allowCellular)';

@override
bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}

return other is DownloadTask &&
other.taskId == taskId &&
other.status == status &&
other.progress == progress &&
other.url == url &&
other.filename == filename &&
other.savedDir == savedDir &&
other.timeCreated == timeCreated &&
other.allowCellular == allowCellular;
}

@override
int get hashCode {
return Object.hash(
taskId,
status,
progress,
url,
filename,
savedDir,
timeCreated,
allowCellular,
);
}
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_downloader
description: Powerful plugin making it easy to download files.
version: 1.10.6
version: 1.10.7
repository: https://github.com/fluttercommunity/flutter_downloader
issue_tracker: https://github.com/fluttercommunity/flutter_downloader/issues
maintainer: Bartek Pacia (@bartekpacia)
Expand Down

0 comments on commit d59e16d

Please sign in to comment.