fromString static method

WidgetLayout? fromString(
  1. String? value
)

Creates a WidgetLayout from a string value.

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

Implementation

static WidgetLayout? fromString(String? value) {
  if (value == null) return null;
  switch (value.toLowerCase()) {
    case 'compact':
      return WidgetLayout.compact;
    case 'expanded':
      return WidgetLayout.expanded;
    case 'detailed':
      return WidgetLayout.detailed;
    default:
      return null;
  }
}