fromStringValue static method

GiphyResizeMode fromStringValue(
  1. String value
)

Converts a string value to a corresponding GiphyResizeMode enum value.

Throws an ArgumentError if the given string does not match any GiphyResizeMode values.

value The string representation of the resize mode.

Returns the matching GiphyResizeMode value.

Implementation

static GiphyResizeMode fromStringValue(String value) {
  switch (value) {
    case 'center':
      return GiphyResizeMode.center;
    case 'contain':
      return GiphyResizeMode.contain;
    case 'cover':
      return GiphyResizeMode.cover;
    case 'stretch':
      return GiphyResizeMode.stretch;
    default:
      throw ArgumentError('Unknown ResizeMode value: $value');
  }
}