BlobByteSource class

A RandomAccessByteSource that reads a browser Blob — usually a File from an <input type="file"> or a drop event — one slice at a time, so a slide opened from it with SvsFile.openSource is never loaded into memory whole, however large it is.

import 'package:svs/svs.dart';
import 'package:svs/svs_web.dart';
import 'package:web/web.dart' as web;

Future<SvsFile> openPicked(web.File file) =>
    SvsFile.openSource(BlobByteSource(file));
Implemented types

Constructors

BlobByteSource(JSObject blob)
Wraps blob, which must be a JS Blob (a File is one) — throws ArgumentError otherwise. Takes a plain JSObject so any binding works, e.g. package:web's File/Blob.

Properties

hashCode → int
The hash code for this object.
no setterinherited
length → int
The blob's size in bytes.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

close() → Future<void>
A no-op: a Blob holds no handle to release.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
readRange(int offset, int length) → Future<Uint8List>
Reads up to length bytes starting at offset. Best-effort at the end of the source: returns fewer bytes (down to empty) rather than padding or throwing. The reader checks the length it gets back itself, and reports a truncated file as an SvsFormatException.
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited