HybridStruct class
Value type that bridges with C-ABI struct layout.
Every @HybridStruct field crosses the FFI boundary on every call:
primitive fields (int, double, bool) are copied by value at zero cost;
String fields are heap-copied via strdup/free on both sides,
adding ~100–500 ns per call — the cost grows with string length.
D4 guidance: If your struct carries one or more String fields that are
frequently updated or compared, prefer @HybridRecord instead. Records
are binary-encoded once and decoded lazily, making them significantly
cheaper for text-heavy data (device names, error messages, config strings).
✅ Use @HybridStruct for hot-path data where all fields are numeric
or boolean (sensor readings, camera frames, pixel coordinates).
✅ Use @HybridRecord for structured data with String fields or
collections (device lists, configuration objects, API responses).
Constructors
-
HybridStruct({List<
String> zeroCopy = const [], bool packed = false}) -
const
Properties
Methods
-
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