distribute static method

List<PortDefinition> distribute({
  1. required PortSide side,
  2. required Iterable<String> ids,
  3. PortStyle style = const PortStyle(),
})

Implementation

static List<PortDefinition> distribute({
  required PortSide side,
  required Iterable<String> ids,
  PortStyle style = const PortStyle(),
}) {
  final portIds = List<String>.of(ids);
  return List.unmodifiable([
    for (var index = 0; index < portIds.length; index++)
      PortDefinition.onSide(
        id: portIds[index],
        side: side,
        position: (index + 1) / (portIds.length + 1),
        style: style,
      ),
  ]);
}