NitroVariant class

Marks a Dart sealed class as a discriminated union type (sum type / tagged union).

The sealed class itself is the variant type. Each concrete subclass becomes one case of the variant. Cases with fields encode them using the same binary record codec as @HybridRecord.

Wire format: [1B tag 0..N] [optional payload bytes — record codec]

E014: More than 10 cases are rejected at validation time.

Example:

@NitroVariant()
sealed class FilterResult { const FilterResult(); }

class FilterAccepted extends FilterResult {
  final String id;
  const FilterAccepted({required this.id});
}
class FilterRejected extends FilterResult { const FilterRejected(); }

Constructors

NitroVariant()
const

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

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