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

flutter_file_info 封面
插件详情v0.3.0

flutter_file_info

一个用于检索详细文件元数据的 Flutter 插件,包括由文件类型分配的原生图标。

AndroidiOSmacOSWindows
近 30 天下载
233
喜欢数
11
Pub 分数
130

安装插件

flutter pub add flutter_file_info

插件介绍

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

flutter_file_info 是一个 Flutter 插件,可获取详细的文件元数据,例如文件大小、创建日期和文件类型。它支持基于文件扩展名由操作系统分配的原生图标,从而在不同平台上保持视觉一致性。该插件专为 Android、iOS、macOS 和 Windows 设计,可无缝集成到文件管理应用程序中。该插件简化了对系统级文件信息的访问,无需编写平台特定代码。非常适合需要丰富文件预览或详细文件属性的应用程序。

适合场景

  • 文件浏览器开发
  • 媒体文件元数据提取
  • 文件预览缩略图
  • 跨平台文件实用工具
  • 桌面文件管理

主要特点

  • 按类型显示原生文件图标
  • 跨平台支持
  • 文件大小和时间戳检索
  • 简单的 API 集成
  • 可扩展的元数据访问

适合对象

  • 开发文件浏览器的开发者
  • 需要文件元数据的应用程序
  • 桌面和移动文件工具
  • 带有文件预览的 UI
  • 需要文件信息的插件

使用建议

  • 需要平台特定权限
  • 仅限基本文件元数据
  • 图标渲染可能因操作系统而异
  • 不适用于大文件扫描
  • 依赖于底层操作系统文件系统 API

原始 README

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

header

Flutter Windows Tests pub package pub likes License: MIT

flutter_file_info

A Flutter plugin for retrieving detailed file metadata, including system-native file icons. You can retrieve the native icon assigned to a file based on its type, ensuring a consistent visual representation across platforms. Perfect for applications that require access to file details and icons.

Features

  • Access to native file icons.
  • Retrieval of detailed file metadata.

Compatibility Chart

API Android iOS Linux macOS Windows Web
getFileIconInfo() :heavy_check_mark: :heavy_check_mark: :x: :heavy_check_mark: :heavy_check_mark: :x:
getFileInfo() :heavy_check_mark: :heavy_check_mark: :x: :heavy_check_mark: :heavy_check_mark: :x:

iOS Deployment Target

This plugin requires a minimum iOS deployment target of 13.0. Ensure that your project is configured correctly by following these steps:

  1. Update the Podfile

    In the ios/Podfile file, set the deployment target:

    platform :ios, '13.0'
    

    After making this change, run:

    cd ios && pod install
    
  2. Update Xcode Project Settings

    1. Open your project in Xcode (ios/Runner.xcworkspace).
    2. Navigate to Runner → General.
    3. In the Deployment Info section, set iOS Deployment Target to 13.0.

These steps ensure that your project is compatible with the required iOS version.

Getting Started

Usage

Quick simple usage example:

Get icon info
IconInfo? iconInfo = await FileInfo.instance.getFileIconInfo('path/to/example/file.txt');

Widget _buildFileIcon() {
    if (iconInfo == null) return const SizedBox.shrink();
    return Image.memory(
      iconInfo!.pixelData,
      width: iconInfo!.width.toDouble(),
      height: iconInfo!.height.toDouble(),
    );
  }
Get file info
FileMetadata? fileMetadata = await FileInfo.instance.getFileInfo('path/to/example/file.txt');

if (fileMetadata != null) {
    print(fileMetadata.fileName);                    // Output: file.txt
    print(fileMetadata.fileExtension);               // Output: txt
    print(fileMetadata.fileType);                    // Output: TextDocument
    print(fileMetadata.creationTime?.toString());    // Output: 2024-08-01 17:16:26.500018
    // ...
}

Screenshots

Windows

windows_example

MacOS

macos_example

iOS

ios_example

Android

android_example

Contributing

If you would like to contribute to the development of this plugin, please fork the repository and submit a pull request. For detailed contribution guidelines, please refer to the CONTRIBUTING.md file.

License

This plugin is licensed under the MIT License.

所属分类

依赖

依赖清单 5 项

源码仓库

使用此插件的项目

暂无相关数据。