openFile static method

Future<bool> openFile(
  1. String filePath
)

Open file with system default application

Implementation

static Future<bool> openFile(String filePath) async {
  if (!Platform.isAndroid && !Platform.isIOS) {
    throw UnsupportedError(
        'Native file opening is only supported on Android and iOS');
  }

  try {
    final result = await _methodChannel.invokeMethod<bool>('openFile', {
      'filePath': filePath,
    });
    return result ?? false;
  } catch (e) {
    print('FilePickerPlatform.openFile error: $e');
    return false;
  }
}