Skip to content

A Flutter plugin for retrieving detailed file metadata, including native icons.

License

Notifications You must be signed in to change notification settings

makjac/flutter_file_info

Repository files navigation

header

Flutter Windows Tests pub package pub likes License: MIT

flutter_file_info

A Flutter plugin for retrieving detailed file metadata, including native icons. Ideal for applications needing file information and icons.

Currently supported features

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

Compatibility Chart

API Android iOS Linux macOS Windows Web
getFileIconInfo() ✔️ ✔️
getFileInfo() ✔️ ✔️

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(),
    );
  }

Fet file info

FileMetadata? _fileMetatdata = await FileInfo.instance.getFileInfo('path/to/example/file.txt');

if (_fileMetatdata != 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

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.