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

插件详情v0.2.0

storage_path

一个用于获取图像、音频、视频和文件路径的 Flutter 插件。

近 30 天下载
397
喜欢数
53
Pub 分数
40

安装插件

flutter pub add storage_path

插件介绍

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

storage_path 包是一个 Flutter 插件,旨在简化在 Android 和 iOS 设备上获取图像、音频、视频及其他文件路径的操作。它提供了一个简单的 API,用于访问应用程序的文档、缓存以及外部存储等常见存储目录。此工具可帮助开发者管理文件存储,而无需处理平台特定的路径逻辑。该包轻量且专注于路径解析,非常适合处理媒体或文件操作的应用程序。

适合场景

  • 访问应用文档目录
  • 获取媒体文件路径
  • 管理缓存文件
  • 存储用户生成的内容
  • 处理文件上传
  • 使用外部存储

主要特点

  • 跨平台路径解析
  • 简单直观的 API
  • 支持图片、音频、视频和通用文件
  • 无额外依赖
  • 轻量且快速
  • 跨平台文件路径访问

适合对象

  • 媒体密集型应用
  • 文件管理工具
  • 需要本地存储的应用程序
  • 开发者原型
  • 处理用户上传文件的应用程序

使用建议

  • 不处理文件操作(例如读/写)
  • 仅限路径检索
  • 某些平台需要手动处理权限
  • 缺少目录时没有内置的错误处理
  • 不适合复杂的文件系统操作

原始 README

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

StoragePath

A flutter plugin to get all images, audios, videos and files location path in json format.

Only for Android. If you like this plugin, buy me a cup of coffee. PayPal

dependencies:
 storage_path: ^0.2.1
import 'package:storage_path/storage_path.dart';

Sample Code

 try {
      imagePath = await StoragePath.imagesPath; //contains images path and folder name in json format
    } on PlatformException {
      imagesPath = 'Failed to get path';
    }

AND

videoPath = await StoragePath.videoPath; //this will return videos path
audioPath = await StoragePath.audioPath; //this will return audios path
filePath = await StoragePath.filePath; //this will return files path

Image Json Sample


[
 {
   "files": [
     "path/screenshot/abc.png",
     "path/screenshot/pqr.png"
   ],
   "folderName": "screenshot"
 }
]

File Json Sample

[
  {
    "files": [
      {
        "mimeType": "application/pdf",
        "size": "34113",
        "title": "C001-SP-2719^201902",
        "path": "/storage/emulated/0/Download/abc.pdf"
      }
    ],
    "folderName": "Download"
  }
]

Audio Json Sample

[
  {
    "files": [
      {
        "album": "ABC",
        "artist": "PQR",
        "path": "/storage/emulated/0/Download/todo.mp3",
        "dateAdded": "1515060080",
        "displayName": "todo.mp3",
        "duration": "235986",
        "size": "9506989"
      }
    ],
    "folderName": "Download"
  }
]

Video Json Sample

[
  {
    "files": [
      {
        "path": "/storage/emulated/0/DCIM/Camera/VID_20190304_112455.mp4",
        "dateAdded": "1551678904",
        "displayName": "VID_20190304_112455.mp4",
        "duration": "7147",
        "size": "12787914"
      }
    ],
    "folderName": "Camera"
  }
]

Thank you for contribution

所属分类

源码仓库

使用此插件的项目

暂无相关数据。