withGap method

List<Widget> withGap(
  1. double space
)

Add a gap between each child.

Implementation

List<Widget> withGap(double space) {
  assert(space >= 0, 'Space should be a non-negative value.');

  List<Widget> newChildren = [];
  for (int i = 0; i < length; i++) {
    newChildren.add(this[i]);
    if (i < length - 1) {
      newChildren.add(SizedBox(height: space));
    }
  }

  return newChildren;
}