encodeMainAxisAlignment static method

String? encodeMainAxisAlignment(
  1. MainAxisAlignment? value
)

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

  • center
  • end
  • spaceAround
  • spaceBetween
  • spaceEvenly
  • start

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

Implementation

static String? encodeMainAxisAlignment(MainAxisAlignment? value) {
  String? result;

  if (value != null) {
    switch (value) {
      case MainAxisAlignment.center:
        result = 'center';
        break;
      case MainAxisAlignment.end:
        result = 'end';
        break;
      case MainAxisAlignment.spaceAround:
        result = 'spaceAround';
        break;
      case MainAxisAlignment.spaceBetween:
        result = 'spaceBetween';
        break;
      case MainAxisAlignment.spaceEvenly:
        result = 'spaceEvenly';
        break;
      case MainAxisAlignment.start:
        result = 'start';
        break;
    }
  }

  return result;
}