decodeBlob method
Uint8List
decodeBlob({
- required List<
SliverData> primarySlivers, - required int numShards,
- required int unencodedLength,
Decode (reconstruct) a blob from collected primary slivers.
Uses the walrus-core RS2 decoder via Rust FFI — the same decoder
used by the Walrus network for canonical reconstruction.
Requires at least primarySymbols primary slivers (from any shards)
to reconstruct the original data.
Returns the original unencoded blob data, trimmed to
unencodedLength.
Implementation
Uint8List decodeBlob({
required List<SliverData> primarySlivers,
required int numShards,
required int unencodedLength,
}) {
if (primarySlivers.isEmpty) {
throw StateError('decodeBlob: no slivers provided');
}
final ffi = _requireFFI();
final slivers = primarySlivers
.map((s) => (index: s.index, data: s.data))
.toList();
return ffi.decodeBlob(
nShards: numShards,
blobSize: unencodedLength,
slivers: slivers,
);
}