Skip to content
pubscout

uri_to_file

1.0.0, released 3 years ago by an unverified publisher

Convert supported URIs, including Android content URIs, into local File objects.

$ flutter pub add uri_to_file
Source repository

What it does

Provides a Flutter plugin to convert URI strings into dart:io File instances. It supports Android content:// URIs by copying them to a temporary file in the app directory, alongside standard URIs handled by File.fromUri.

AI-written summary of version 1.0.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to handle Android content:// URIs from intents or deep links and convert them to readable files.
  • You are working with deep linking packages like uni_links and need to process incoming URI strings as files.

Skip it when

  • You pass Uri objects converted via uri.toString(), which transforms strings to lowercase and breaks functionality.
  • You only need standard path manipulation without resolving custom URI schemas.

Strengths

  • Simplifies handling of Android content URIs in Flutter.
  • Supports standard URIs handled natively by File.fromUri.
  • Easy-to-use asynchronous API.

Weaknesses

  • Requires passing raw URI strings rather than standard Uri objects due to lowercase conversion issues.
  • Limited to Android and iOS platforms.

Setup

Kind
Plugin (native code)
Effort
Low
Code generation
No
Direct dependencies
1

Not documented

import 'dart:io';
import 'package:uri_to_file/uri_to_file.dart';

Future<void> convertUriToFile() async {
  try {
    String uriString = 'content://sample.txt';
    File file = await toFile(uriString);
  } catch (e) {
    print(e);
  }
}

Alternatives

Packages that do the same job and could replace uri_to_file.

  • activity_files

    Toolkit for parsing, editing, validating, and converting workout activity files in GPX, TCX, FIT, GeoJSON, and CSV.

  • path_provider

    Provides Flutter APIs to locate common filesystem directories on Android, iOS, macOS, Linux and Windows.

  • file_picker

    Use the native file explorer to pick single or multiple files, directories, and save files.

  • background_downloader

    Multi-platform background file downloading and uploading for Flutter.

Works with

Packages commonly used together with uri_to_file: ones it builds on, ones built on it, and its own family.