encodeColor static method

String? encodeColor(
  1. Color? value
)

Encodes the given value to the String representation. This will always use a hash encoded 8 digit string: "#aarrbbgg" format.

This will return null if the value is null.

Implementation

static String? encodeColor(Color? value) {
  String? result;

  if (value != null) {
    var hex = value.value.toRadixString(16).padLeft(8, '0');
    result = '#$hex';
  }

  return result;
}