Issue
content://com.whatsapp.provider.mediaitem/89aab7b2-da3d-49c7-b7b1-53a01bf34f7a Uri giving me this path, i tried Uri.parse() and Uri.decode() both functions not are working for me.I need file path from this Uri in flutter. The package i am using is receive_sharing_intent: ^1.4.2
and code i am using
Uri value = await ReceiveSharingIntent.getInitialTextAsUri();
Solution
You can use uri_to_file plugin to fetch the path from content://uri
. To use, simply parse the uri and use toFile(uri)
import 'package:uri_to_file/uri_to_file.dart';
try {
String uriPath = 'content://com.whatsapp.provider.mediaitem/89aab7b2-da3d-49c7-b7b1-53a01bf34f7a';
Uri uri = Uri.parse(uriPath);
File file = await toFile(uri);
} catch (e) {
debugPrint(e);
}
Answered By - Omatt
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.