Optional class final

Marks a class-first field as optional on the wire.

The JSON key may be omitted. This does not change whether a present JSON value may be null: a nullable Dart type still accepts JSON null, and @NotNull() rejects it. Valid only when the constructor can accept a missing value, with a discriminator-specific exception for union branches.

Annotations
  • @Target.new({TargetKind.field})

Constructors

Optional()
Creates an optional-presence annotation.
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