onlyIf method
Returns this value only if condition is true.
Otherwise, returns null.
Example:
token.onlyIf(isLoggedIn);
Implementation
T? onlyIf(bool? condition) {
if (condition == true) return this;
return null;
}
Returns this value only if condition is true.
Otherwise, returns null.
Example:
token.onlyIf(isLoggedIn);
T? onlyIf(bool? condition) {
if (condition == true) return this;
return null;
}