chore: Follow up android download dir

This commit is contained in:
Krille 2023-03-19 09:03:56 +01:00
parent df91290a18
commit 0222e6ecd5
No known key found for this signature in database

View File

@ -1,4 +1,3 @@
import 'dart:developer';
import 'dart:io'; import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -55,12 +54,9 @@ extension MatrixFileExtension on MatrixFile {
} }
Future<Directory> getDownloadDirectoryAndroid() async { Future<Directory> getDownloadDirectoryAndroid() async {
final downloadDirectories = await getExternalStorageDirectories( final defaultDownloadDirectory = Directory('/storage/emulated/0/Download');
type: StorageDirectory.downloads, if (await defaultDownloadDirectory.exists()) {
); return defaultDownloadDirectory;
if (downloadDirectories != null && downloadDirectories.isNotEmpty) {
inspect(downloadDirectories);
return downloadDirectories.first;
} }
return await getApplicationDocumentsDirectory(); return await getApplicationDocumentsDirectory();
} }