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

插件详情v1.0.1

download

适用于 Dart 和 Flutter 项目的跨平台文件下载器。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
1.7万
喜欢数
82
Pub 分数
140

安装插件

flutter pub add download

插件介绍

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

下载包为 Dart 和 Flutter 应用程序提供了一个跨平台的文件下载器,可在 Android、iOS、Web、macOS、Windows 和 Linux 上实现无缝文件下载。它提供了一个简单的 API,用于启动下载、监控进度,并使用平台特定优化处理文件存储。该工具设计可靠且易于使用,支持后台下载,并可无缝集成到需要离线内容或媒体检索的应用程序中。

适合场景

  • 从移动应用程序中的URL下载文件
  • 获取离线使用的资源
  • 支持所有平台的后台下载
  • 与媒体或文档管理功能集成
  • 通过可下载的捆绑包启用应用更新

主要特点

  • 跨平台兼容性
  • 下载过程中的进度跟踪
  • 后台下载支持
  • 简单的集成API
  • 平台优化的文件处理

适合对象

  • 移动和桌面 Flutter 应用
  • 需要离线内容的应用程序
  • 媒体或文档密集型应用
  • 需要可靠文件检索的项目
  • 寻求最小化设置以进行下载的开发者

使用建议

  • Android 和 iOS 需要正确的权限
  • Web 支持受限于浏览器策略
  • 大文件可能需要内存管理
  • 文件路径处理因平台而异
  • 某些平台上的后台执行限制

原始 README

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

Cross-Platform file downloader for Dart and Flutter projects.

pub package

Demo

Web Demo

Features

Supports these platforms:

  • Android
  • iOS
  • Linux
  • MacOS
  • Web
  • Windows

There are a few caveats about this package:

  • On the web it caches the contents in a Blob and eventually saves the file in browser's default location.
  • On desktop it saves the file in absolute or relative path.
  • On mobile it saves the file in absolute or relative path, but we should ask/ensure if the app has the required permissions.
  • On the web, not supported in IE or Edge (prior version 18), or in Safari (prior version 10.1).

Getting started

In your pubspec.yaml file add:

dependencies:
  download: any

Then, in your code import:

import 'package:download/download.dart';

Usage

final stream = Stream.fromIterable('Hello World!'.codeUnits);
download(stream, 'hello.txt');

or

import 'package:http/http.dart';
const url = 'http://example.com';

final stream = get(url);
download(stream, 'hello.txt');

Please refer to /example folder for a working example.

Additional information

Please feel free to contribute to the project or file an issue.

所属分类

源码仓库

使用此插件的项目