If<T> class

A class that implements the OvO interface and provides an if-else-like composition.

The If class takes a condition, a then branch, and an optional orElse branch. If the condition is true, the then branch is executed, otherwise the orElse branch is executed. If there is no orElse branch and the condition is false, an OvOException is thrown.

Example usage:

final schema = If(
  condition: SomeConditionSchema(),
  then: SomeSchema(),
  orElse: SomeOtherSchema(),
);
Implemented types
Available extensions

Constructors

If(OvO condition, {required OvO<T> then, OvO<T>? orElse, String? message})
Creates a If-case OvO schema.
const

Properties

condition OvO
Represents the condition for the if case.
final
hashCode int
The hash code for this object.
no setterinherited
message String?
Error message to be thrown when the condition is false and there is no orElse branch.
final
orElse OvO<T>?
An optional value of type OvO that is used as a fallback when the main value is null.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
then OvO<T>
The then property is an instance of OvO class. It represents the value to be returned if the condition in the if statement is true.
final

Methods

contains(Pattern value, {String? message}) String

Available on String, provided by the OvOString extension

endsWith(String value, {String? message}) String

Available on String, provided by the OvOString extension

equals(String value, {String? message}) String

Available on String, provided by the OvOString extension

finite({String? message}) Number<T>

Available on Number<T>, provided by the NumberOvO extension

gt(T value, {String? message}) Number<T>

Available on Number<T>, provided by the NumberOvO extension

gte(T value, {String? message}) Number<T>

Available on Number<T>, provided by the NumberOvO extension

handle(Context context, dynamic data) Future<T>
override
isFalse({String? message}) Boolean

Available on Boolean, provided by the BooleanOvO extension

isNotEmpty({String? message}) String

Available on String, provided by the OvOString extension

isTrue({String? message}) Boolean

Available on Boolean, provided by the BooleanOvO extension

length(int length, {String? message}) String

Available on String, provided by the OvOString extension

lt(T value, {String? message}) Number<T>

Available on Number<T>, provided by the NumberOvO extension

lte(T value, {String? message}) Number<T>

Available on Number<T>, provided by the NumberOvO extension

max(int length, {String? message}) OvO<Iterable<T>>

Available on OvO<Iterable<T>>, provided by the ArrayOvO extension

max(int length, {String? message}) String

Available on String, provided by the OvOString extension

min(int length, {String? message}) OvO<Iterable<T>>

Available on OvO<Iterable<T>>, provided by the ArrayOvO extension

min(int length, {String? message}) String

Available on String, provided by the OvOString extension

negative({String? message}) Number<T>

Available on Number<T>, provided by the NumberOvO extension

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
nullable() OvO<T?>

Available on OvO<T>, provided by the Nullable extension

Returns an instance of OvO that wraps the current value with nullable type.
parse([Object? data]) Future<T>

Available on OvO<T>, provided by the OvOParser extension

refine(FutureOr<bool> test(T data), {required String message}) OvO<T>

Available on OvO<T>, provided by the Refine extension

regex(RegExp regex, {String? message}) String

Available on String, provided by the OvOString extension

size(int length, {String? message}) OvO<Iterable<T>>

Available on OvO<Iterable<T>>, provided by the ArrayOvO extension

startsWith(Pattern value, {String? message}) String

Available on String, provided by the OvOString extension

toLowerCase() String

Available on String, provided by the OvOString extension

toString() String
A string representation of this object.
inherited
toUpperCase() String

Available on String, provided by the OvOString extension

transform<R>(FutureOr<R> transform(Context context, dynamic data, Future<T> next(dynamic data))) OvO<R>

Available on OvO<T>, provided by the OvOTransform extension

trim() String

Available on String, provided by the OvOString extension

unique({String? message}) OvO<Iterable<T>>

Available on OvO<Iterable<T>>, provided by the ArrayOvO extension

withDefault(T defaultValue) OvO<T>

Available on OvO<T>, provided by the WithDefault extension

Operators

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