ifElse<T> method
T
ifElse<T>(
- T onTrue(),
- T onFalse()
Executes the onTrue function if the boolean is true, otherwise
executes the onFalse function.
Example:
bool flag = true;
flag.ifElse(
() => print("Flag is true"),
() => print("Flag is false")
); // Output: Flag is true
Implementation
T ifElse<T>(T Function() onTrue, T Function() onFalse) =>
this ? onTrue() : onFalse();