encodeBoxFit static method

String? encodeBoxFit(
  1. BoxFit? value
)

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

  • contain
  • cover
  • fill
  • fitHeight
  • fitWidth
  • none
  • scaleDown

Implementation

static String? encodeBoxFit(BoxFit? value) {
  String? result;

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

      case BoxFit.cover:
        result = 'cover';
        break;

      case BoxFit.fill:
        result = 'fill';
        break;

      case BoxFit.fitHeight:
        result = 'fitHeight';
        break;

      case BoxFit.fitWidth:
        result = 'fitWidth';
        break;

      case BoxFit.none:
        result = 'none';
        break;

      case BoxFit.scaleDown:
        result = 'scaleDown';
        break;
    }
  }

  return _stripDynamicNull(result);
}