Expectation class

Represents an expectation for a validation result.

Constructors

Expectation.new({String? path, required String message, dynamic value, String? code, Map<String, Object?>? data})

Properties

code String?
Optional machine‑readable code (e.g. 'type_mismatch', 'required_missing')
final
data Map<String, Object?>?
Optional structured metadata (e.g. {'expectedType': 'String', 'foundType': 'int'})
final
description String
Get a detailed description of the expectation.
no setter
hashCode int
The hash code for this object.
no setterinherited
message String
final
path String?
The path to the value being validated. i.e. 'user.name'
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shortDescription String
Get a short description of the expectation.
no setter
value → dynamic
final

Methods

addToPath(String additionalPath) Expectation
Append additionalPath to the current path.
copyWith({String? path, String? message, dynamic value, String? code, Map<String, Object?>? data}) Expectation
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toInvalidResult() Result
Convenient method to convert the expectation to an invalid result.
toJson() Map<String, Object?>
toString() String
A string representation of this object.
override

Operators

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