搜索插件、代码仓与 APP 分类

插件详情v2.1.0

open_file_manager

一个用于打开默认文件管理器应用的 Flutter 插件。在 Android 上,它会在文件管理器应用中打开下载/最近文件夹。在 iOS 上,它会在 Files 应用中打开应用的文档文件夹。

AndroidiOS
近 30 天下载
1.5万
喜欢数
39
Pub 分数
160

安装插件

flutter pub add open_file_manager

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

一个 Flutter 插件,用于打开设备的默认文件管理器应用。在 Android 上,它会导航到下载或最近文件夹;在 iOS 上,它会在 Files 应用中打开应用的文档目录。这使得用户能够轻松地在其应用上下文中访问和管理文件,而无需自定义文件浏览界面。该插件通过利用原生系统行为简化了文件导航,确保跨平台的一致用户体验。

适合场景

  • 在文件应用中打开特定于应用的文档
  • 导航到最近或已下载的文件
  • 从应用内启用用户文件管理
  • 与文件保存工作流程集成
  • 提供对应用存储目录的快速访问

主要特点

  • 跨平台兼容性(Android 和 iOS)
  • 使用最少的设置打开默认文件管理器
  • 直接导航到下载/最近或应用文档
  • 使用原生系统文件浏览器
  • 通过 pub add 命令进行简单集成

适合对象

  • 需要文件访问功能的应用
  • 文件共享或文档管理应用
  • 生成或保存本地文件的应用程序
  • 寻求原生文件浏览器集成的开发者
  • 项目需要最少的文件UI复杂性

使用建议

  • 对特定文件夹选择的控制有限
  • 依赖设备的默认文件管理器
  • 不支持自定义文件浏览 UI
  • 行为可能在不同设备间略有差异
  • 不直接处理文件创建或编辑

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Open File Manager

A Flutter plugin to open the default File Manager 📁 app.

Platform Support

Android iOS
SDK 21+ iOS 12+

Use of AndroidFolderType.other requires minimum SDK 26 in Android.

Features 🚀

  • Android:

    • Ability to open Recent, Downloads, and Other folders.
    • For the Other folder, you need to specify the folder path.
  • iOS:

    • Ability to open the app’s Documents folder and its subdirectories.

Please follow the iOS platform configuration ⬇️ before jump to the Dart code.

iOS Configuration

The iOS app can open the app’s Documents folder and its subdirectories if specified.

The plugin will open the Files app on iOS. To display your app’s Documents folder under On My iPhone, add the following code snippet to your Info.plist:

<key>UISupportsDocumentBrowser</key>  
<true/>

Additionally, you must save at least one file to your app’s Documents folder for it to appear in the Files app.

Code Implementation 👨‍💻

It's a super simple to implement. Just call the openFileManager method and add androidConfig for Android and iosConfig for iOS.

import 'package:open_file_manager/open_file_manager.dart';

openFileManager(
   androidConfig: AndroidConfig(
       folderType: AndroidFolderType.recent,
   ),
   iosConfig: IosConfig(
       // Path is case-sensitive here.
       folderPath: 'Reports/Sheets',
   ),
);
Default method without config:
import 'package:open_file_manager/open_file_manager.dart';

openFileManager();

If androidConfig is not provided, the Android app will open the Downloads folder by default.

If iosConfig is not provided, the iOS app will open the app's Documents folder by default.

Open Other folder on Android:

To open a specific folder on Android, you need to set folderType as AndroidFolderType.other and provide the folderPath in AndroidConfig:

import 'package:open_file_manager/open_file_manager.dart';

openFileManager(
    androidConfig: AndroidConfig(
        folderType: AndroidFolderType.other,
        folderPath: 'Pictures/Screenshots',
    ),
);

The folderPath supports the following path formats:

  • Pictures/Screenshots
  • /storage/emulated/0/Pictures/Screenshots
  • /storage/243F-4E12/Pictures/Screenshots

If folderPath does not exist, the Recent folder will be opened.

所属分类

依赖

依赖清单 1 项

  • plugin_platform_interface^2.1.8

源码仓库

使用此插件的项目