WalrusFfiBindings class

Dart FFI bindings for the walrus_ffi native library.

Provides canonical Walrus RS2 blob encoding and metadata computation that is bit-identical to walrus-core / walrus-wasm.

Library Discovery

The native library is searched in this order:

  1. Path set via configure (call before first use)
  2. WALRUS_FFI_LIB environment variable
  3. Relative to the dartus package source directory (auto-resolved)
  4. Relative to the current working directory
  5. System library paths (/usr/local/lib/)

For Flutter apps, call configure early (e.g. in main()) with the correct path to libwalrus_ffi.dylib.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

computeMetadata(int nShards, Uint8List data) → WalrusBlobMetadata
Compute blob metadata (blob ID, root hash) without returning slivers.
decodeBlob({required int nShards, required int blobSize, required List<({Uint8List data, int index})> slivers}) → Uint8List
Decode (reconstruct) a blob from primary slivers via Rust FFI.
encodeBlob(int nShards, Uint8List data) → WalrusFfiEncodedBlob
Full encode: compute metadata AND all primary + secondary slivers.
encodingParams(int nShards, int blobLen) → WalrusEncodingParams
Get encoding parameters for a given shard count and blob size.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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

Static Properties

isAvailable → bool
Whether the native library has been loaded successfully.
no setter
resolvedPath → String?
The file path of the loaded native library, or null if not loaded.
no setter

Static Methods

configure(String path) → void
Pre-configure the native library path before first use.
instance({String? libraryPath}) → WalrusFfiBindings
Get or create the singleton instance.
reset() → void
Reset the singleton — useful for testing with different library paths.