GitHub 儲存庫ParthSheth021299/flutter_media_downloader

flutter_media_downloader

用於下載媒體檔案的 Flutter 插件

flutter_media_downloader 專案封面
星標
5
分支
30
最近推送(UTC)
2026年3月7日
專案狀態
未封存

原始 README

以下為英文專案原文快照,最新內容請造訪 GitHub。

flutter_media_downloader

This plugin helps user to download medias for example pdf files, image files etc. A plugin for creating and managing download tasks. Supports iOS and Android.

This plugin is using native methods for push notifications for both platforms (Android & iOS). This is easy to use plugin.

Working Demo

DEMO

Android integration

You just need to add permissions in your manifest file for the push notification. And other permission for read external storage.

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
    <!-- For Android 13+ (API 33 and above) -->
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
Open downloaded file from notification

To make tapping on notification open the downloaded file on Android, add the following code to AndroidManifest.xml:

<provider
    android:name="androidx.core.content.FileProvider"
    android:authorities="${applicationId}.provider"
    android:exported="false"
    android:grantUriPermissions="true">
    <meta-data
        android:name="android.support.FILE_PROVIDER_PATHS"
        android:resource="@xml/provider_paths" />
</provider>

Notes

  • By default location is provided you can also change it as per your need. Apart from this you can also provide filename if you want to change.
  • Here in this plugin for iOS device when media file is downloaded then it is open and from there you can store wherever you wan to store.
  • Here for push notifications in both the devices native methods are used.
  • For the permission handling you don't need manage it externally all the things are setup you just need to use it.

Usage

Import and full example of using this plugin
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter_media_downloader/flutter_media_downloader.dart';

void main() {

  runApp(const MyApp());
  WidgetsFlutterBinding.ensureInitialized();
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

  final _flutterMediaDownloaderPlugin = MediaDownload();

  @override
  void initState() {
    super.initState();

  }
  @override
  Widget build(BuildContext context) {

    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: ElevatedButton(onPressed: () async {
            _flutterMediaDownloaderPlugin.downloadMedia(context,'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf');
          }, child: const Text('Media Download')),
        ),
      ),
    );
  }
}

Support the Project

If you find this plugin helpful, consider supporting its development:

Your support is greatly appreciated!

Bugs/Requests

Feel free to open an issue if you encounter any problems or think that the plugin is missing some feature.

Email parthsheth100@gmail.com

Parth Sheth GitHub avatar
GitHub 作者

Parth Sheth ↗

🚀 Flutter Developer | Building Beautiful Cross-Platform Apps 📱 2 Years of Flutter Experience | 💡 Passionate About Crafting Engaging User Experiences🌐

語言C++CMakeKotlinDartSwiftRubyCHTMLObjective-C

此儲存庫發佈的套件

使用的依賴

依賴清單 7 項

如何選擇適合專案的儲存庫?

先依使用情境篩選,再比較專案活躍情況,最後到原始儲存庫確認使用要求。

  1. 透過儲存庫名稱、作者或描述搜尋,再依技術分類縮小範圍。
  2. 綜合星標、分支與最近推送比較專案;星標反映社群關注,不保證品質。
  3. 使用前在 GitHub 確認 README、授權條款與 Issues。

來源與維護

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗