Closed odam1 closed 3 years ago
intent.action.VIEW is handled in package as url type. When user try open a file, android system send the uri of this file to intent.
if you need open file with dart:io functions like readAdBytes or readAsString, you should convert the Uri to full path. You can do this with uri_to_file package.
So, you can handle action.VIEW with this code in flutter side:
import 'package:uri_to_file/uri_to_file.dart';
...
// For sharing or opening urls/text coming from outside the app while the app is closed
ReceiveSharingIntent.getInitialText().then((String? value) async {
String _sharedText = value ?? "";
debugPrint('path of file: ${Uri.parse(_sharedText).path}');
File file = await toFile(_sharedText);
var fileContent = await file.readAsString();
...
});
I added some representative change request, but there is more of your personal ids that need to be reverted ;-)