WidgetStateBorderSide.fromMap constructor

const WidgetStateBorderSide.fromMap(
  1. WidgetStateMap<BorderSide?> map
)

Creates a WidgetStateBorderSide from a WidgetStateMap.

This constructor's resolve method finds the first MapEntry whose key is satisfied by the set of states, and returns its associated value.

If used as a regular BorderSide, the first key that matches an empty Set of WidgetStates will be selected.

Example:

const Chip(
  label: Text('Transceiver'),
  side: WidgetStateBorderSide.fromMap(<WidgetStatesConstraint, BorderSide?>{
    WidgetState.selected: BorderSide(color: Colors.red),
    // returns null if not selected, deferring to default theme/widget value.
  }),
),

To prevent a situation where each WidgetStatesConstraint isn't satisfied by the given set of states, consier adding WidgetState.any as the final WidgetStateMap key.

Implementation

const factory WidgetStateBorderSide.fromMap(WidgetStateMap<BorderSide?> map) = _WidgetBorderSideMapper;