toBoolean static method

bool toBoolean(
  1. dynamic d,
  2. bool def
)

Converts a dynamic value to a non-nullable boolean.

d - The dynamic value to be converted. def - The default boolean value if conversion fails. Returns a boolean.

Implementation

static bool toBoolean(dynamic d, bool def) {
  return toBooleanN(d) ?? def;
}