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
-
- OvO<
T>
- OvO<
- Available extensions
Constructors
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
orElsebranch.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
thenproperty is an instance ofOvOclass. It represents the value to be returned if the condition in theifstatement is true.final
Methods
-
contains(
Pattern value, {String? message}) → String -
endsWith(
String value, {String? message}) → String -
equals(
String value, {String? message}) → String -
finite(
{String? message}) → Number< T> -
gt(
T value, {String? message}) → Number< T> -
gte(
T value, {String? message}) → Number< T> -
handle(
Context context, dynamic data) → Future< T> -
override
-
isFalse(
{String? message}) → Boolean -
Available on Boolean, provided by the BooleanOvO extension
-
isNotEmpty(
{String? message}) → String -
isTrue(
{String? message}) → Boolean -
Available on Boolean, provided by the BooleanOvO extension
-
length(
int length, {String? message}) → String -
lt(
T value, {String? message}) → Number< T> -
lte(
T value, {String? message}) → Number< T> -
max(
int length, {String? message}) → OvO< Iterable< T> > -
Available on OvO<
Iterable< , provided by the ArrayOvO extensionT> > -
max(
int length, {String? message}) → String -
min(
int length, {String? message}) → OvO< Iterable< T> > -
Available on OvO<
Iterable< , provided by the ArrayOvO extensionT> > -
min(
int length, {String? message}) → String -
negative(
{String? message}) → Number< T> -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
nullable(
) → OvO< T?> -
Available on OvO<
Returns an instance of OvO that wraps the current value with nullable type.T> , provided by the Nullable extension -
parse(
[Object? data]) → Future< T> -
refine(
FutureOr< bool> test(T data), {required String message}) → OvO<T> -
regex(
RegExp regex, {String? message}) → String -
size(
int length, {String? message}) → OvO< Iterable< T> > -
Available on OvO<
Iterable< , provided by the ArrayOvO extensionT> > -
startsWith(
Pattern value, {String? message}) → String -
toLowerCase(
) → String -
toString(
) → String -
A string representation of this object.
inherited
-
toUpperCase(
) → String -
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 -
unique(
{String? message}) → OvO< Iterable< T> > -
Available on OvO<
Iterable< , provided by the ArrayOvO extensionT> > -
withDefault(
T defaultValue) → OvO< T> -
Available on OvO<
T> , provided by the WithDefault extension
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited