expand method

PositionSeries expand(
  1. ExpandPosition expand
)

Expands this position to an iterable of zero or more positions of using expand.

When expand returns zero or one position it can be considered implementing a filter.

Implementation

PositionSeries expand(ExpandPosition expand) {
  final source = positions;
  // ignore: avoid_returning_this
  if (source.isEmpty) return this;

  final target = <Position>[];
  for (final pos in source) {
    target.addAll(pos.expand(expand));
  }

  return PositionSeries.from(target);
}