fromString static method

WidgetSize? fromString(
  1. String? value
)

Creates a WidgetSize from a string value.

Returns null if the string doesn't match any enum value.

Implementation

static WidgetSize? fromString(String? value) {
  if (value == null) return null;
  switch (value.toLowerCase()) {
    case 'small':
      return WidgetSize.small;
    case 'medium':
      return WidgetSize.medium;
    case 'large':
      return WidgetSize.large;
    default:
      return null;
  }
}