asBool method
Converts the dynamic value to a boolean.
If the value is null, returns the provided default value or false.
The conversion considers '1' and 'true' (case insensitive) as true,
and any other value as false.
def The default value to return if the dynamic value is null.
Returns the boolean representation of the dynamic value or the default value.
Implementation
bool asBool({bool? def}) {
var value = this ?? def;
return value.toString().toBool;
}