Converts a JavaScript value to a Dart boolean.
Returns def when the value cannot be interpreted as a boolean.
def
bool toBool([bool def = false]) => toNullableBool() ?? def;