getFlexedDataFromString static method

Map<BreakpointMapper, double> getFlexedDataFromString(
  1. String? input
)

Parses flex data string (e.g., "md-6 sm-12") into a map of breakpoints to column spans.

Implementation

static Map<BreakpointMapper, double> getFlexedDataFromString(String? input) {
  input ??= "";
  final Map<BreakpointMapper, double> flexData = {};

  for (final item in input.split(' ')) {
    for (final type in customBreakpoints) {
      if (item.startsWith('${type.className}-')) {
        final flex = double.tryParse(
          item.substring(type.className.length + 1),
        );
        if (flex != null) {
          flexData[type] = flex;
        }
      }
    }
  }

  return getFilledMedia(flexData, flexColumns.toDouble());
}