openDocument static method

dynamic openDocument(
  1. String path
)

Implementation

static openDocument(String path) async {
  // if (await askStoragePermission()) {
  if (MediaUtils.isMediaExists(path)) {
    final result = await OpenFile.open(path);
    debugPrint(result.message);
    if (result.message.contains("file does not exist")) {
      toToast(getTranslated("unableToOpen"));
    } else if (result.message.contains('No APP found to open this file')) {
      toToast(getTranslated("youMayNotProperApp"));
    }
  } else {
    toToast(getTranslated("mediaDoesNotExist"));
    debugPrint("media does not exist");
  }
}