mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-17 09:35:12 +00:00
chore: Follow up download android
This commit is contained in:
parent
447af2772f
commit
686a5764c2
1 changed files with 9 additions and 3 deletions
|
@ -1,3 +1,4 @@
|
|||
import 'dart:developer';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
@ -49,14 +50,19 @@ extension MatrixFileExtension on MatrixFile {
|
|||
}
|
||||
|
||||
Future<String> getDownloadPathAndroid() async {
|
||||
final directory = await getDownloadDirectoryAndroid();
|
||||
return '${directory.path}/$name';
|
||||
}
|
||||
|
||||
Future<Directory> getDownloadDirectoryAndroid() async {
|
||||
final downloadDirectories = await getExternalStorageDirectories(
|
||||
type: StorageDirectory.downloads,
|
||||
);
|
||||
if (downloadDirectories != null && downloadDirectories.isNotEmpty) {
|
||||
return downloadDirectories.first.path;
|
||||
inspect(downloadDirectories);
|
||||
return downloadDirectories.first;
|
||||
}
|
||||
final fallbackDirectory = await getApplicationDocumentsDirectory();
|
||||
return fallbackDirectory.path;
|
||||
return await getApplicationDocumentsDirectory();
|
||||
}
|
||||
|
||||
FileType get filePickerFileType {
|
||||
|
|
Loading…
Reference in a new issue