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

パッケージ詳細v5.2.3

flutter_document_picker

ユーザーがドキュメントを選択できるようにします。選択されたドキュメントは、アプリの一時ディレクトリにコピーされます。オプションで、特定の拡張子を持つドキュメントのみを選択できるようにできます。

AndroidiOS
30日間ダウンロード
1.9万
いいね数
52
Pub ポイント
150

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

flutter pub add flutter_document_picker

パッケージ概要

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

Flutterパッケージで、ユーザーがデバイスのファイルシステムからドキュメントを選択できるようにします。選択されたドキュメントは、安全なアクセスを確保するためにアプリの一時ディレクトリに自動的にコピーされます。特定の拡張子でファイルをフィルタリングする機能を備えており、目的別ファイル選択の使いやすさを向上させます。AndroidおよびiOSに対応し、ネイティブファイルピッカーとシームレスに統合されています。ファイルシステムへの直接アクセスなしにドキュメントのアップロードやインポートが必要なアプリに最適です。

用途

  • フォーム内の文書アップロード
  • ユーザーが作成したファイルをインポートする
  • アプリ間でのファイル共有
  • 外部構成ファイルの読み取り
  • ドキュメントベースのワークフローをサポート

主な機能

  • 拡張子フィルタを適用してドキュメントを選択する
  • 自動的にファイルを一時ディレクトリにコピーします
  • クロスプラットフォーム(Android & iOS)
  • シンプルな API インテグレーション
  • セキュアな一時ファイルの処理

適している対象

  • ファイル入力が必要なアプリ
  • ドキュメント管理機能
  • ユーザー主導のファイルインポート
  • モバイルデータ収集ツール
  • プライバシーに配慮したファイルアクセス

注意事項

  • ファイルは一時ストレージにコピーされます
  • サポートされているファイル形式に限定
  • プラットフォーム固有の権限が必要です
  • 一時ファイルはアプリの再起動時に削除される可能性があります
  • 元のファイルパスへの直接アクセスはできません

元の README

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

flutter_document_picker

Allows user pick a document. Picked document is copied to app temporary directory. Optionally allows pick document with specific extension only.

When file is picked its extension is checked using allowedFileExtensions parameter. Then file is copied to app temp directory. Copied file path is returned as result. If picked file extension is not in allowedFileExtensions list then extension_mismatch error is returned.

In Android Intent.ACTION_OPEN_DOCUMENT is used. This intent is supported only from Android 19 (KitKat) SDK version. So this plugin can be used only if app minSdkVersion is 19 or more.

In iOS UIDocumentPickerViewController is used. Files can be filtered by list of UTI types using allowedUtiTypes parameter. Picked file path is returned as result.

Params

Plugin has 3 optional parameters to help pick only specific document type:

  • List<String> allowedUtiTypes (used only in iOS)

    In iOS Uniform Type Identifiers is used to check document types. If list is null or empty "public.data" document type will be provided. Only documents with provided UTI types will be enabled in iOS document picker.

    More info: https://developer.apple.com/library/archive/qa/qa1587/_index.html

  • List<String> allowedFileExtensions (used both in iOS and in Android)

    List of file extensions that picked file should have. If list is null or empty - picked document extension will not be checked.

  • List<String> allowedMimeTypes (used only in Android)

    Only files with provided MIME types will be shown in document picker. If list is null or empty - */* MIME type will be used.

  • List<String> invalidFileNameSymbols (used both in iOS and in Android)

    List symbols that will be sanitized to "_" in the selected document name. I.e. Google Drive allows symbol '/' in the document name, but this symbol is not allowed in file name that will be saved locally.

    Default list: ['/'].

    Example: file name 'Report_2018/12/08.txt' will be replaced to 'Report_2018_12_08.txt'

Example

//Without parameters:
final path = await FlutterDocumentPicker.openDocument();
  
  ...

    
//With parameters:
FlutterDocumentPickerParams params = FlutterDocumentPickerParams(      
  allowedFileExtensions: ['mwfbak'],
  allowedUtiTypes: ['com.sidlatau.example.mwfbak'],
  allowedMimeTypes: ['application/*'],
  invalidFileNameSymbols: ['/'],
);

final path = await FlutterDocumentPicker.openDocument(params: params);

//Pick multiple files:
final paths = await FlutterDocumentPicker.openDocuments(params: params);

カテゴリー

ソースリポジトリ

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

データはまだありません。