Option<T extends CandidType?> class

Option candid type.

var non_null_optional_text = Option(value: Text('hi'));
var null_optional_text = Option(value: null, value_type: Text());

Check the documentation on the candid library page for more on creating an Option with a null value.

Inheritance

Constructors

Option({T? value, T? value_type, bool type_mode = false})

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
type_mode bool
latefinaloverride-getter
value ↔ T?
The value within the Option. Can be set to null. When setting to null make sure the value_type is specified. Check the documentation on the candid library page for more.
latefinal
value_type ↔ T?
A CandidType in the type_mode. Check the documentation on the candid library page for more.
latefinal

Methods

cast_option<C extends CandidType>() Option<C>
Casts an Option<CandidType> into an Option<C extends CandidType>. Useful for casting the type of this.value into a specific CandidType
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

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

Constants

type_code → const int