isBoolean function

bool isBoolean(
  1. String str
)

Checks if the string represents a boolean value.

Returns true if the string is one of: 'true', 'false', '1', or '0', otherwise returns false.

Example:

isBoolean('true'); // true
isBoolean('false'); // true
isBoolean('1'); // true
isBoolean('0'); // true
isBoolean('yes'); // false

Implementation

bool isBoolean(String str) => _isBoolean(str);