UnionSpec class final

Specification for union/sealed class types.

Represents a type that can be one of several variants, such as Freezed union types or Dart sealed classes.

Inheritance

Constructors

UnionSpec({required String name, String? discriminator, required List<ObjectSpec> variants, String? description, bool nullable = false, List<Object>? examples, bool isDeprecated = false})
Creates a new UnionSpec.
const

Properties

description String?
Optional description of this type.
finalinherited
discriminator String?
The discriminator property name.
final
examples List<Object>?
Example values for documentation.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
isDeprecated bool
Whether this type is deprecated.
finalinherited
name String
The name of this union type.
final
nullable bool
Whether this type accepts null values.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
variants List<ObjectSpec>
The possible variants of this union.
final

Methods

asNullable() UnionSpec
Creates a copy of this spec with nullable set to true.
override
copyWith({String? name, String? discriminator, List<ObjectSpec>? variants, String? description, bool? nullable, List<Object>? examples, bool? isDeprecated}) UnionSpec
Creates a copy with the given modifications.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
withDescription(String description) UnionSpec
Creates a copy of this spec with the given description.
override

Operators

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