platform/bounded_file_snapshot library

Functions

readBoundedByteStreamSnapshot(Stream<List<int>> source, {required String resourcePath, required int maxBytes}) Future<Uint8List>
Accumulates a bounded byte snapshot from source.
readBoundedFileSnapshot(File file, {required int maxBytes}) Future<Uint8List>
Reads at most maxBytes from one stream-backed file snapshot.
readBoundedFileStringSnapshot(File file, {required int maxBytes, Encoding encoding = utf8}) Future<String>

Exceptions / Errors

BoundedFileSnapshotOverflowException
Raised when a file snapshot contains more bytes than its caller permits.