toColorString function
Implementation
String? toColorString(Color? color) {
if (Platform.isIOS) {
return color != null
? '#${color.red.toRadixString(16).padLeft(2, '0')}${color.green.toRadixString(16).padLeft(2, '0')}${color.blue.toRadixString(16).padLeft(2, '0')}${color.alpha.toRadixString(16).padLeft(2, '0')}'
: null;
}
return color != null
? '#${color.value.toRadixString(16).padLeft(8, '0')}'
: null;
}