Fix open file
This commit is contained in:
parent
078cd96ee5
commit
72affed827
|
@ -9,9 +9,6 @@ import 'package:mime_type/mime_type.dart';
|
||||||
|
|
||||||
extension MatrixFileExtension on MatrixFile {
|
extension MatrixFileExtension on MatrixFile {
|
||||||
void open() async {
|
void open() async {
|
||||||
Directory tempDir = await getTemporaryDirectory();
|
|
||||||
final file = File(tempDir.path + "/" + path.split("/").last);
|
|
||||||
file.writeAsBytesSync(bytes);
|
|
||||||
if (kIsWeb) {
|
if (kIsWeb) {
|
||||||
final fileName = path.split('/').last;
|
final fileName = path.split('/').last;
|
||||||
final mimeType = mime(fileName);
|
final mimeType = mime(fileName);
|
||||||
|
@ -27,6 +24,9 @@ extension MatrixFileExtension on MatrixFile {
|
||||||
element.click();
|
element.click();
|
||||||
element.remove();
|
element.remove();
|
||||||
} else {
|
} else {
|
||||||
|
Directory tempDir = await getTemporaryDirectory();
|
||||||
|
final file = File(tempDir.path + "/" + path.split("/").last);
|
||||||
|
file.writeAsBytesSync(bytes);
|
||||||
await OpenFile.open(file.path);
|
await OpenFile.open(file.path);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue