validate method
Validates the given integer and returns the provided default value if null.
int? number;
print(number.validate()); // Output: 0
print(number.validate(5)); // Output: 5
Implementation
int validate([int value = 0]) => this ?? value;