fluffychat/lib/utils/matrix_file_extension.dart

16 lines
436 B
Dart
Raw Normal View History

2020-03-29 20:13:25 +02:00
import 'dart:io';
import 'package:famedlysdk/famedlysdk.dart';
import 'package:open_file/open_file.dart';
import 'package:path_provider/path_provider.dart';
extension MatrixFileExtension on MatrixFile {
void open() async {
Directory tempDir = await getTemporaryDirectory();
final file = File(tempDir.path + "/" + path.split("/").last);
file.writeAsBytesSync(bytes);
await OpenFile.open(file.path);
return;
}
}