Skip to content

Commit f411ce5

Browse files
authored
fix FlutterDownloader.open() always returning false (#726)
1 parent 21381d8 commit f411ce5

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.8.4
2+
3+
- Fix `FlutterDownloader.open()` always returning false (#726)
4+
15
## 1.8.3+2
26

37
- Populate `issue_tracker` field in pubspec (#717)

lib/src/downloader.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,9 @@ class FlutterDownloader {
340340
static Future<bool> open({required String taskId}) async {
341341
assert(_initialized, 'plugin flutter_downloader is not initialized');
342342

343+
bool? result;
343344
try {
344-
final result = await _channel.invokeMethod<bool>(
345+
result = await _channel.invokeMethod<bool>(
345346
'open',
346347
{'task_id': taskId},
347348
);
@@ -351,10 +352,9 @@ class FlutterDownloader {
351352
}
352353
} on PlatformException catch (err) {
353354
_log('Failed to open downloaded file. Reason: ${err.message}');
354-
return false;
355355
}
356356

357-
return false;
357+
return result ?? false;
358358
}
359359

360360
/// Registers a [callback] to track the status and progress of a download

pubspec.yaml

Lines changed: 1 addition & 1 deletion
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.8.3+2
3+
version: 1.8.4
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)