BacktrackingSolver<State, Choice> constructor

const BacktrackingSolver<State, Choice>({
  1. required Iterable<Choice> choices(
    1. State
    ),
  2. required State apply(
    1. State,
    2. Choice
    ),
  3. required bool isComplete(
    1. State
    ),
  4. required bool isValid(
    1. State
    ),
})

Creates a solver from the four pure callbacks that define the search:

  • choices: candidate moves available from a state (empty = dead end).
  • apply: produces the new state reached by taking a choice.
  • isComplete: whether a state is a full, accepted solution.
  • isValid: whether a partial state is still worth exploring; returning false prunes the whole branch before any deeper recursion. Audited: 2026-06-12 11:26 EDT

Implementation

const BacktrackingSolver({
  required this.choices,
  required this.apply,
  required this.isComplete,
  required this.isValid,
});