toBoolean function
Convert value to boolean if defined, else return undefined. @param value value converted
Implementation
bool? toBoolean(String? value) {
if (value == null) {
return null;
}
return value == 'true' || value == '1' || value.isNotEmpty;
}