openFile method

Future<OpenResult> openFile(
  1. String filePath
)

Implementation

Future<OpenResult> openFile(String filePath) async {
  try {
    // Copy to cache to ensure FileProvider access
    final accessiblePath = await _getAccessiblePath(filePath);

    // Explicitly specify text/csv to help Android find the right app
    return await OpenFilex.open(accessiblePath, type: 'text/csv');
  } catch (e) {
    return OpenResult(
      type: ResultType.error,
      message: 'Failed to prepare file: $e',
    );
  }
}