open static method

Future<UFileByteSource> open(
  1. String path
)

Implementation

static Future<UFileByteSource> open(String path) async {
  final File file = File(path);
  if (!file.existsSync()) throw UDocError(code: UDocErrorCode.notFound, message: "File not found", path: path);
  try {
    final RandomAccessFile handle = await file.open();
    final int size = await handle.length();
    return UFileByteSource._(path, handle, size);
  } on FileSystemException catch (e) {
    throw UDocError(code: UDocErrorCode.permission, message: "Cannot open file", detail: e.message, path: path);
  }
}