NullableRule class

A validation rule that allows null values. It effectively removes any other validation rules if the value is null. This rule should be listed first if you want to allow nulls.

Inheritance

Constructors

NullableRule()

Properties

contextValues Map<String, dynamic>?
Provide the values from the data to the rule, null if none
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
name String
The name of the validation rule. This should be a unique identifier for the rule.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

message(dynamic value, [List<String>? options]) String
The message that will be displayed if the validation fails. This message should be user-friendly and explain why the validation failed.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
validate(dynamic value, [List<String>? options]) bool
Validates the given value against the rule.
override

Operators

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