Struct class

Represents a custom object type.

Inheritance

Constructors

Struct({required String name, Map<String, $Type> fields = const {}, bool nullable = false, String? description})
Represents a custom object type.
const

Properties

description String?
The description of the signature, if any.
finalinherited
fields Map<String, $Type>
The fields of the object.
final
hashCode int
The hash code for this object.
no setterinherited
name String
The name of the type.
finalinherited
nullable bool
If true, the type is nullable. (e.g., int?).
finalinherited
props List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stringify bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited

Methods

asNullable([bool nullable = true]) $Type
Returns a nullable version of this type.
override
canCast($Type other) bool
Returns true if this type can be implicitly cast to the other type.
override
cast($Type type, dynamic value) → dynamic
Casts a value of this type to the specified type.
inherited
lookup(List<Struct> types) Struct?
Looks up a placeholder struct by its name in the provided types and Struct.defaults list.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Converts this signature to a JSON map.
inherited
toMap() Map<String, dynamic>
Converts the signature to a map.
override
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

defaults List<Struct>
Default structs defined within the language.
final
error Struct
Stdandard error struct used in Dscript.
final