fix: get downloads directory correctly

This commit is contained in:
Tien Do Nam
2023-06-02 13:09:58 +02:00
parent caa42af7e5
commit 75f1817c34
4 changed files with 17 additions and 2 deletions
+3 -1
View File
@@ -2,8 +2,10 @@
- feat: dynamic colors (Material You) (by @Tienisto)
- feat: sharing APKs includes version in file name (by @Tienisto)
- fix: cancellation fixes during active file transfer (by @SelaseKay)
- feat(windows): use specialized fonts for Chinese, Japanese and Korean (by @graphemecluster, @Tienisto)
- fix: cancellation fixes during active file transfer (by @SelaseKay)
- fix: possible settings corruption on Windows (by @TheGB0077, @Tienisto)
- fix(android): get downloads directory correctly (by @Tienisto)
## 1.9.1 (2023-05-05)
@@ -1,10 +1,14 @@
import 'package:flutter/foundation.dart';
import 'package:path_provider/path_provider.dart' as path;
import 'package:shared_storage/environment.dart';
import 'package:shared_storage/shared_storage.dart' as shared_storage;
Future<String> getDefaultDestinationDirectory() async {
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return '/storage/emulated/0/Download';
// ignore: deprecated_member_use
final dir = await shared_storage.getExternalStoragePublicDirectory(EnvironmentDirectory.downloads);
return dir?.path ?? '/storage/emulated/0/Download';
case TargetPlatform.iOS:
return (await path.getApplicationDocumentsDirectory()).path;
case TargetPlatform.linux:
+8
View File
@@ -1174,6 +1174,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.2.0"
shared_storage:
dependency: "direct main"
description:
name: shared_storage
sha256: "2761c1f6562d7cfb7626982d3fc7ce0bb1d9bf86ff7db2f6d77ee078d8f57de9"
url: "https://pub.dev"
source: hosted
version: "0.7.1"
shelf:
dependency: "direct main"
description:
+1
View File
@@ -45,6 +45,7 @@ dependencies:
screen_retriever: 0.1.6
share_handler: 0.0.16
shared_preferences: 2.1.1
shared_storage: 0.7.1
shelf: 1.4.1
shelf_router: 1.1.4
slang: 3.18.0