NativeUnionVal class

Represents a union value for Soroban contract specifications. Used when passing union type values to contract functions.

Union types in Stellar contracts can have two forms:

  1. Void case - just a tag name (e.g., "Success", "Error")
  2. Tuple case - a tag name with associated values (e.g., "Data" with values ["field1", "field2"])

Constructors

NativeUnionVal(String tag, {List? values})
Creates a union value with the specified tag and optional values
const
NativeUnionVal.tupleCase(String tag, List? values)
Creates a tuple union case with associated values
const
NativeUnionVal.voidCase(String tag)
Creates a void union case (no associated values)
const

Properties

hashCode → int
Returns the hash code for this instance based on its fields.
no setteroverride
isTupleCase → bool
Returns true if this is a tuple case (has associated values)
no setter
isVoidCase → bool
Returns true if this is a void case (no associated values)
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
tag → String
The union case name/tag
final
values → List?
Optional values for tuple cases. Null for void cases.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
Returns a string representation of this instance for debugging.
override

Operators

operator ==(Object other) → bool
Compares this instance to another for equality.
override