notFound method

String notFound(
  1. String verb,
  2. String described,
  3. String? screen, {
  4. bool blank = false,
  5. bool scrolls = true,
  6. String? hint,
  7. String prelude = '',
})

The nothing-matched refusal.

hint is what the resolver worked out about this miss — a rendered string that differs from the wanted one by an invisible character, or a semantics label carrying the words. It replaces the guess rather than joining it: told the exact string is on screen, a reader does not also need to be told to scroll. prelude goes in front of either, for the part of a composed target that failed before the miss itself matters.

scrolls is whether the screen holds a Scrollable at all. The lazy-list guess was once unconditional, and "nothing matches" has two very different causes: on a real suite it sent a reader hunting scroll positions when the list the target should have been in was empty — the screenshot said so, the message pointed away from it. So the guess only offers scrollTo where scrolling exists, and names the empty-list cause beside it either way.

Implementation

String notFound(
  String verb,
  String described,
  String? screen, {
  bool blank = false,
  bool scrolls = true,
  String? hint,
  String prelude = '',
}) {
  var guess = blank && blankScreenHint.isNotEmpty
      ? blankScreenHint
      : scrolls
      ? 'Either it is further down a lazy list and not built yet '
            '(`${prefix}scrollTo` walks to it), or the list that would hold '
            'it is empty. The visible text shows which.'
      : 'Nothing on this screen scrolls, so the widget was never built. '
            'The visible text is everything on the screen.';
  return 'nothing matches $described, which `$prefix$verb` needs. '
      '$prelude${hint ?? guess}'
      '${screen == null ? '' : '\nVisible text: $screen'}';
}