パッケージ、リポジトリ、アプリカテゴリを検索

uri_to_file のカバー
パッケージ詳細v1.0.0

uri_to_file

サポートされたURIをファイルに変換するためのFlutterプラグイン。AndroidとiOSをサポートしています。

AndroidiOS
30日間ダウンロード
5210
いいね数
44
Pub ポイント
160

パッケージをインストール

flutter pub add uri_to_file

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

AndroidおよびiOSでサポートされているURIをFileオブジェクトに変換するFlutterプラグインです。画像やドキュメントなどのさまざまなURIソースからファイルにアクセスできるようにし、それらを使用可能なFileインスタンスに変換します。ファイルピッカー、カメラキャプチャ、または外部ファイル参照と連携する際に特に役立ちます。このプラグインは、プラットフォーム固有のロジックを抽象化することで、クロスプラットフォームアプリでのファイル処理を簡素化します。

用途

  • ギャラリーからの画像URIをファイルに変換
  • 外部ソースからのドキュメントファイルパスの処理
  • カメラからキャプチャされたメディアの処理
  • 共有ストレージからファイルを読み込む
  • ファイルピッカー・プラグインとの統合
  • URIからのファイルアップロードをサポート

主な機能

  • Android および iOS 用のクロスプラットフォーム対応
  • 簡単な URI からファイルへの変換
  • 一般的なファイル形式を処理します
  • 最小限のセットアップが必要
  • ネイティブファイルシステムアクセスと連携可能
  • ファイルピッカー統合と互換性あり

適している対象

  • URIからのファイルアクセスが必要なアプリ
  • メディア処理ワークフロー
  • ファイルアップロード機能
  • 画像および文書の取り扱い
  • ファイルピッカーまたはカメラを使用する開発者

注意事項

  • Android および iOS のみをサポート
  • ファイルアクセスに適切な権限が必要です
  • サポートされているURIスキームに制限されています
  • すべてのカスタムまたは暗号化されたURIで動作するとは限りません
  • 下位プラットフォームの実装に依存する

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

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: ^1.0.0
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

    // Don't pass uri parameter using [Uri] object via uri.toString().
    // Because uri.toString() changes the string to lowercase which causes this package to misbehave

    // If you are using uni_links package for deep linking purpose.
    // Pass the uri string using getInitialLink() or linkStream

    File file = await toFile(uriString); // Converting uri to file
  } catch (e) {
    print(e); // Exception
  }
}
Important note
  • Don't pass uri parameter using [Uri] object via uri.toString(). Because uri.toString() changes the string to lowercase which causes this package to misbehave
  • If you are using uni_links package for deep linking purpose. Pass the uri string using getInitialLink() or linkStream
  • Check out the full example: https://pub.dev/packages/uri_to_file/example
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)

Copyright & License

MIT License

Features and bugs

Please file feature requests and bugs at the issue tracker.

カテゴリー

依存関係

依存関係一覧 1 件

  • plugin_platform_interface^2.0.2

ソースリポジトリ

このパッケージを使用しているプロジェクト