combine static method

List<InteractiveTextType> combine(
  1. Iterable<Iterable<InteractiveTextType>> groups, {
  2. Iterable<InteractiveTextType> include = const [],
  3. Iterable<InteractiveTextType> exclude = const [],
})

Combines groups and individual types while preserving declaration order.

Implementation

static List<InteractiveTextType> combine(
  Iterable<Iterable<InteractiveTextType>> groups, {
  Iterable<InteractiveTextType> include = const [],
  Iterable<InteractiveTextType> exclude = const [],
}) {
  final excluded = exclude.toSet();
  final seen = <InteractiveTextType>{};
  final result = <InteractiveTextType>[];

  for (final group in [...groups, include]) {
    for (final type in group) {
      if (!excluded.contains(type) && seen.add(type)) result.add(type);
    }
  }
  return UnmodifiableListView(result);
}