Char.create constructor
Creates a new Char for the given charOrCharCode
(which must be an
int or non-empty String) using the optional foreground
and
background
Colors.
Implementation
factory Char.create(Object charOrCharCode,
[Color? foreground, Color? background]) {
if (charOrCharCode is String && charOrCharCode.isNotEmpty) {
return Char(charOrCharCode.codeUnits[0], foreground, background);
} else if (charOrCharCode is int) {
return Char(charOrCharCode, foreground, background);
} else {
throw ArgumentError.value(charOrCharCode, 'charOrCharCode',
'Argument must be a non-empty String or an int');
}
}