fromStringValue static method

GiphyFileFormat fromStringValue(
  1. String value
)

Converts a string value to a corresponding GiphyFileFormat enum value.

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

value The string representation of the Giphy file format.

Returns the matching GiphyFileFormat value.

Implementation

static GiphyFileFormat fromStringValue(String value) {
  switch (value) {
    case 'gif':
      return GiphyFileFormat.gif;
    case 'mp4':
      return GiphyFileFormat.mp4;
    case 'webp':
      return GiphyFileFormat.webp;
    default:
      throw ArgumentError('Unknown GiphyFileFormat value: $value');
  }
}