solveFirst method

State? solveFirst(
  1. State initial
)

Returns the first complete solution reachable from initial, or null if the search exhausts every valid branch without finding one. Audited: 2026-06-12 11:26 EDT

Implementation

State? solveFirst(State initial) {
  final List<State> found = _search(initial, 1);
  // _search caps at the requested limit, so at most one element is present;
  // firstOrNull yields that one solution or null on the no-solution case
  // without a throwing accessor.
  return found.firstOrNull;
}