open static method
Open a file on disk with the system's default viewer.
- iOS: Quick Look preview (
QLPreviewController) — modal with native preview for common types. The built-in toolbar still exposes Share. - macOS: hands off to the system default app (
NSWorkspace.open). - Android:
Intent.ACTION_VIEW— launches the default viewer app. - Windows: the shell opens the file with its associated application, or offers its app chooser for a type that has none, after Windows's security checks for a file marked as downloaded.
mimeType hints the viewer on Android. Ignored on Apple platforms
and Windows (the system infers from the file extension).
Returns true if the viewer opened. Returns false when no viewer is available (Android: no app registered for the MIME; macOS: no associated app; Windows: the shell reports no association). On Windows a launch the user declines at SmartScreen's warning also returns true.
Implementation
static Future<bool> open({
required String path,
String? mimeType,
Uint8List? bookmark,
}) async {
final result = await _channel.invokeMethod<bool>('open', {
'path': path,
'mimeType': ?mimeType,
'bookmark': ?bookmark,
});
return result ?? false;
}