uri_to_file 0.1.3 copy "uri_to_file: ^0.1.3" to clipboard
uri_to_file: ^0.1.3 copied to clipboard

outdated

A Flutter plugin for converting supported uri to file. Supports Android & iOS.

uri_to_file #

Pub

A Flutter plugin for converting supported uri to file. Supports Android & iOS.

Supported Uri Schema

  • content:// (Android Only)
  • Schema supported by File.fromUri(uri)

Get started #

Add dependency #

dependencies:
  uri_to_file: ^0.1.3

Super simple to use #

import 'dart:io';

import 'package:uri_to_file/uri_to_file.dart';

Future<void> convertUriToFile() async {
  try {
    String uriString = 'content://sample.txt'; // Uri string
    Uri uri = Uri.parse(uriString); // Parsing uri string to uri
    File file = await toFile(uri); // Converting uri to file
  } on UnsupportedError catch (e) {
    print(e.message); // Unsupported error for uri not supported
  } on IOException catch (e) {
    print(e); // IOException for system error
  } on Exception catch (e) {
    print(e); // General exception
  }
}

Working example #

Working example

Background #

  • content:// (Android Only) uri_to_file creates a temporary file using the content:// uri with the help of native channel that stores this file in the application directory.

  • All the others uri are handled by flutter sdk itself with the help of File.fromUri(uri)

MIT License

Features and bugs #

Please file feature requests and bugs at the issue tracker.

33
likes
0
pub points
95%
popularity

Publisher

unverified uploader

A Flutter plugin for converting supported uri to file. Supports Android & iOS.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on uri_to_file