edgeInsets static method

EdgeInsetsGeometry? edgeInsets(
  1. DataSource source,
  2. List<Object> key
)

Returns an EdgeInsetsDirectional from the specified list.

The list is a list of doubles. 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 EdgeInsetsGeometry? edgeInsets(DataSource source, List<Object> key) {
  final double? a = source.v<double>([...key, 0]);
  if (a == null) {
    return null;
  }
  final double? b = source.v<double>([...key, 1]);
  final double? c = source.v<double>([...key, 2]);
  final double? d = source.v<double>([...key, 3]);
  return EdgeInsetsDirectional.fromSTEB(
    a,
    b ?? a,
    c ?? a,
    d ?? b ?? a,
  );
}