native_file_preview
1.1.0, released 7 months ago by johnnybytes.com
A Flutter plugin providing native file preview capabilities for iOS and Android.
What it does
Allows Flutter applications to open and preview various file formats using the operating system's built-in viewers. It supports local file paths, file:// URLs, and content:// URIs on Android and iOS.
AI-written summary of version 1.1.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to let users preview documents, images, audio, or video using native OS viewers.
- You want an easy way to trigger QuickLook on iOS or Intent-based viewing on Android.
Skip it when
- You need a custom in-app document viewer widget embedded directly inside your widget tree.
- Your target platforms do not include iOS or Android.
Strengths
- Cross-platform compatibility for iOS and Android
- Uses native UI integration (QuickLook and Android Intent system)
- Supports multiple file formats (PDF, DOC, images, audio, video, archives, etc.)
- Supports local paths, file:// URLs, and content:// URIs
Weaknesses
- Actual file support depends on the apps installed on the user's device (especially on Android)
- Only provides full-screen native previews, not embeddable UI components
Setup
- Kind
- Plugin (native code)
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
Android requires a FileProvider configuration in AndroidManifest.xml and a file_paths.xml resource file. iOS requires no additional setup.
import 'package:native_file_preview/native_file_preview.dart';
final _nativeFilePreview = NativeFilePreview();
Future<void> _previewFile(String filePath) async {
await _nativeFilePreview.previewFile(filePath);
}Alternatives
Packages that do the same job and could replace native_file_preview.
- file_picker
If you primarily need to let users select files from their device storage rather than preview them.
93Compare
Works with
Packages commonly used together with native_file_preview: ones it builds on, ones built on it, and its own family.