flutter_web_file_saver 2.0.0
flutter_web_file_saver: ^2.0.0 copied to clipboard
The most comprehensive Flutter web file saver - 25+ methods for text, images, video, audio, ZIP archives, canvas export, batch operations and more!
🚀 flutter_web_file_saver #
The Most Comprehensive Flutter Web File Saver
📸 Screenshots #
| Main demo interface showing all 6 categories | Advanced features: ZIP, Canvas, Batch operations |
| Native browser save dialog |
25+ Methods • ZIP Archives • Canvas Export • Batch Operations
🌟 Why This Package? #
✅ What We Offer #
|
❌ What Others Miss #
|
✨ Features at a Glance #
🗜️ #ZIP Archives Bundle multiple files into |
📸 #Canvas Export One-line screenshot |
🔄 #Batch Operations Save multiple files |
🎥 #Video & Audio Full media file |
📄 #All Formats PDF, CSV, JSON |
⚡ #Simple API Intuitive methods |
📦 Installation #
Add to your pubspec.yaml:
dependencies:
flutter_web_file_saver: ^2.0.0
Then run:
flutter pub get
🚀 Quick Start #
import 'package:flutter_web_file_saver/flutter_web_file_saver.dart';
// Simple text save
await FlutterWebFileSaver.saveText(
content: 'Hello, World!',
filename: 'hello.txt',
);
// Save as ZIP
await FlutterWebFileSaver.saveAsZip(
files: {
'doc.pdf': pdfBytes,
'image.png': imageBytes,
},
zipFilename: 'bundle.zip',
);
// Export canvas
await FlutterWebFileSaver.saveFromCanvas(
key: _chartKey,
filename: 'chart.png',
);
// Batch save
await FlutterWebFileSaver.saveMultipleFiles(
files: fileList,
onProgress: (current, total) => print('$current/$total'),
);
📊 Complete Method List #
| Category | Methods | Description |
|---|---|---|
| Text Files | saveText() |
Plain text files |
saveJson() |
JSON with pretty-print | |
saveCsv() |
CSV with custom delimiter | |
saveHtml() |
HTML pages | |
saveMarkdown() |
Markdown documents | |
saveXml() |
XML data | |
saveAsBase64() |
Base64 encoded | |
| Images | saveImageUrl() |
From URLs/data URLs |
saveFromCanvas() |
Export widget/canvas | |
| Video | saveVideoUrl() |
From URLs |
saveVideoBlob() |
From MediaRecorder | |
saveVideo() |
From bytes | |
| Audio | saveAudioUrl() |
From URLs |
saveAudioBlob() |
From MediaRecorder | |
saveAudio() |
From bytes | |
| Archives | saveAsZip() |
Multiple files → ZIP |
| Batch | saveMultipleFiles() |
Sequential saves |
| Utilities | saveFile() |
Generic binary |
saveWithAutoDetect() |
Auto MIME detection | |
generateDataUrl() |
Create data URLs | |
generateBlobUrl() |
Create blob URLs | |
saveTableAsHtml() |
HTML table generator | |
saveAuto() |
Auto format detection |
Total: 25+ methods!
🎯 Use Cases #
📊 Analytics Dashboards #
|
🛒 E-Commerce #
|
🎨 Design Tools #
|
📚 Education #
|
💡 Examples #
Save as ZIP Archive #
final files = {
'document.pdf': pdfBytes,
'image.png': imageBytes,
'data.json': jsonBytes,
'report.csv': csvBytes,
};
final result = await FlutterWebFileSaver.saveAsZip(
files: files,
zipFilename: 'project_bundle.zip',
);
if (result.success) {
print('ZIP created successfully!');
}
Export Canvas/Screenshot #
// Wrap your widget with RepaintBoundary
final GlobalKey _canvasKey = GlobalKey();
RepaintBoundary(
key: _canvasKey,
child: MyChartWidget(),
)
// Export as image
final result = await FlutterWebFileSaver.saveFromCanvas(
key: _canvasKey,
filename: 'chart_screenshot.png',
pixelRatio: 3.0, // Higher = better quality
);
Batch Save Multiple Files #
final files = [
FileToSave(bytes: pdf1, filename: 'report1.pdf'),
FileToSave(bytes: pdf2, filename: 'report2.pdf'),
FileToSave(bytes: image1, filename: 'chart.png'),
];
final results = await FlutterWebFileSaver.saveMultipleFiles(
files: files,
onProgress: (current, total) {
print('Saving $current of $total');
},
);
// Check results
final allSuccess = results.every((r) => r.success);
Save Video/Audio #
// From MediaRecorder blob
final result = await FlutterWebFileSaver.saveVideoBlob(
videoBlob: recordedBlob,
filename: 'my_recording.webm',
);
// From URL
await FlutterWebFileSaver.saveAudioUrl(
audioUrl: audioUrl,
filename: 'podcast.mp3',
mimeType: MimeTypes.mp3,
);
📖 Documentation #
- Complete API Reference - All 25+ methods documented
- Usage Guide - Real-world examples
- Demo Project - Interactive examples
- Changelog - Version history
🆚 Comparison #
| Feature | This Package | Other Solutions |
|---|---|---|
| Available Methods | ✅ 25+ | ⚠️ Typically 5–10 |
| ZIP File Support | ✅ Yes | ❌ Not commonly supported |
| Canvas Export | ✅ Yes | ❌ Not commonly supported |
| Batch Operations | ✅ Yes | ⚠️ Limited or unavailable |
| Video / Audio Handling | ✅ Yes | ⚠️ Limited |
| Dependencies | ✅ 3 | ⚠️ Typically 5+ |
| Web Optimization | ✅ Designed for web | ⚠️ Varies by implementation |
| Bundle Size Impact | ✅ Small | ⚠️ Medium |
🤝 Contributing #
Contributions are welcome! Please feel free to submit a Pull Request.
📄 License #
This project is licensed under the MIT License - see the LICENSE file for details.
💖 Support #
If you find this package helpful, please:
- ⭐ Star the GitHub repo
- 👍 Like on pub.dev
- 📢 Share with other Flutter developers
Made with ❤️ for the Flutter community
