NotNull class final

Rejects an explicit JSON null without requiring the key to exist.

Needed only when the Dart type is nullable but a present JSON value must not be null. Non-nullable Dart fields already reject JSON null; do not add this annotation there. Dart nullability is unchanged: an omitted optional key still becomes null on a nullable field, and encoding omits a null Dart value.

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

Constructors

NotNull()
Creates a JSON null-rejection 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