Walkable<E>.generate constructor

const Walkable<E>.generate({
  1. required Iterable<E> successors(
    1. E node
    ),
  2. required Iterable<E> roots(),
})

Creates a walkable which generates successors dynamically.

The successors function is called whenever a node is accessed, and the roots function is called whenever the roots are accessed. This allows for lazy generation of nodes and edges.

Note

Pay special attention to Walkable.successors and Walkable.roots respectively, as they are called each time the property is accessed, and have specific constraints on their return values (e.g. both must not return the same node more than once).

Implementation

const factory Walkable.generate({
  required Iterable<E> Function(E node) successors,
  required Iterable<E> Function() roots,
}) = _GeneratedWalkable<E>;