encodeBrightness static method

String? encodeBrightness(
  1. Brightness? value
)

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

  • dark
  • light

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

Implementation

static String? encodeBrightness(Brightness? value) {
  String? result;

  if (value != null) {
    switch (value) {
      case Brightness.dark:
        result = 'dark';
        break;

      case Brightness.light:
        result = 'light';
        break;
    }
  }

  return result;
}