launchFile method

Future<void> launchFile(
  1. String source
)

Implementation

Future<void> launchFile(String source) async {
  if (!File(source).existsSync()) throw Exception('`source` is exists');
  final mime = lookupMimeType(source) ?? '';
  if (mime.startsWith('video')) {
    await openVideoWithIntent(path: source);
    return;
  }
  if (mime.startsWith('application/pdf')) {
    await openPdfWithIntent(path: source);
    return;
  }
  throw Exception('mime:`$mime` not supported');
}