NitroNullableInt class
Collision-free nullable int for Nitro bridges.
Wire format (binary, as a @HybridRecord):
8B: value (int64_le) = 9 bytes
Unlike int? (Int64.min sentinel), every int64 value is representable.
Null is encoded as hasValue=false; the value field is ignored when null.
// In a spec:
NitroNullableInt getCount(); // no sentinel collision
// In Dart call sites:
final r = module.getCount();
final n = r.nullable; // int? — idiomatic Dart
- Available extensions
Constructors
- NitroNullableInt({required bool hasValue, required int value})
-
const
- NitroNullableInt.fromNullable(int? v)
-
Wraps a Dart
int?— null becomeshasValue=false.factory
Properties
- asInt → int?
-
Available on NitroNullableInt, provided by the NitroNullableIntExt extension
Shorthand:nitroVal.asInt→int?no setter - hashCode → int
-
The hash code for this object.
no setteroverride
- hasValue → bool
-
final
- nullable → int?
-
Unwraps to a Dart
int?.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value → int
-
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toNative(
Allocator alloc) → Pointer< Uint8> -
Available on NitroNullableInt, provided by the NitroNullableIntNative extension
-
toString(
) → String -
A string representation of this object.
override
-
writeFields(
RecordWriterBase writer) → void
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Static Methods
Constants
- nullValue → const NitroNullableInt
- Null sentinel (hasValue=false).