toBool property

bool? toBool

Attempts to convert the string to a boolean value. Supports "true" and "false", case-insensitive.

Example:

print('true'.toBool); // Output: true
print('False'.toBool); // Output: false
print('abc'.toBool); // Output: null

Implementation

bool? get toBool => bool.tryParse(this);