asBoolean method

bool asBoolean([
  1. bool? defaultValue
])

The value as a bool: a boolean, "true" / "false", a number (not 0), false for null and a missing node; anything else gives defaultValue, or throws a JsonNodeException without one.

Implementation

bool asBoolean([bool? defaultValue]) =>
    defaultValue ?? (throw _cannotCoerce('asBoolean()', 'boolean'));