border static method

BoxBorder? border(
  1. DataSource source,
  2. List<Object> key
)

Returns a BorderDirectional from the specified list.

The list is a list of values as interpreted by borderSide. An empty or missing list results in a null return value. The list should have one through four items. Extra items are ignored.

The values are interpreted as follows:

  • start: first value.
  • top: second value, defaulting to same as start.
  • end: third value, defaulting to same as start.
  • bottom: fourth value, defaulting to same as top.

Implementation

static BoxBorder? border(DataSource source, List<Object> key) {
  final BorderSide? a = borderSide(source, [...key, 0]);
  if (a == null) {
    return null;
  }
  final BorderSide? b = borderSide(source, [...key, 1]);
  final BorderSide? c = borderSide(source, [...key, 2]);
  final BorderSide? d = borderSide(source, [...key, 3]);
  return BorderDirectional(
    start: a,
    top: b ?? a,
    end: c ?? a,
    bottom: d ?? b ?? a,
  );
}