open static method

Future<FileSource> open(
  1. File file
)

Opens file and reads its length. Holds one file handle until close; the file must exist and not be truncated while operations read it.

Implementation

static Future<FileSource> open(File file) async {
  final raf = await file.open();
  try {
    return FileSource._(raf, await raf.length());
  } catch (_) {
    await raf.close();
    rethrow;
  }
}