tryParseColor function
Implementation
Color? tryParseColor(String? input, {Logger? logger}) {
if (input == null) return null;
try {
return parseCssHexColor(input);
} catch (e, st) {
// The user can manipulate the query string so if the value is invalid
// print the value but otherwise continue.
logger?.warning(
'Failed to parse "$input" as a color from the querystring, ignoring: $e',
e,
st,
);
return null;
}
}