encodeVisualDensity static method

String? encodeVisualDensity(
  1. VisualDensity? value
)

Encodes the given value to the String representation. Supported values are:

  • comfortable
  • compact
  • standard

All other values, including null, will result in null.

Implementation

static String? encodeVisualDensity(VisualDensity? value) {
  String? result;

  if (value != null) {
    if (value == VisualDensity.comfortable) {
      result = 'comfortable';
    } else if (value == VisualDensity.compact) {
      result = 'compact';
    } else if (value == VisualDensity.standard) {
      result = 'standard';
    }
  }

  return result;
}