toBool static method

bool toBool(
  1. dynamic object, {
  2. dynamic mapKey,
  3. int? listIndex,
  4. bool? defaultValue,
  5. ElementConverter<bool>? converter,
})

Converts object to bool using BoolOptions from ConvertConfig.

This conversion never throws. When parsing fails, it returns defaultValue or false when defaultValue is null.

Implementation

static bool toBool(
  dynamic object, {
  dynamic mapKey,
  int? listIndex,
  bool? defaultValue,
  ElementConverter<bool>? converter,
}) => ConvertObjectImpl.toBool(
  object,
  mapKey: mapKey,
  listIndex: listIndex,
  defaultValue: defaultValue,
  converter: converter,
);