openFile static method

Future<bool> openFile({
  1. required File file,
  2. String scheme = "file",
})

Implementation

static Future<bool> openFile({required File file, String scheme = "file"}) async {
  final uri = Uri(path: file.path, scheme: scheme);
  if (await canLaunchUrl(uri)) {
    return await launchUrl(uri);
  } else {
    if (kDebugMode) {
      print("Could not open file ${file.path}");
    }
    return false;
  }
}