Skip to content

Misleading description of guess variable type in Layout tutorial (step 4) #13422

@urandom0

Description

@urandom0

Page URL

https://docs.flutter.dev/learn/pathway/tutorial/layout

Page source

https://github.com/flutter/website/blob/main/sites/docs/src/content/learn/pathway/tutorial/layout.md

Describe the problem

Page: https://docs.flutter.dev/learn/pathway/tutorial/layout — Step 4 ("Arrange widgets with Column and Row")

Description

In the challenge box at the end of step 4, the following statement appears:

"Add a Tile to each row for each letter allowed in the guess. The guess variable in the loop is a record with the type ({String char, HitType type})."

This is misleading. The outer loop variable guess iterates over _game.guesses, which is a list of lists — so guess is itself a list of ({String char, HitType type}) records, not a single record.

The variable that actually has the type ({String char, HitType type}) is letter in the inner loop, as shown in the solution:

for (var letter in guess) Tile(letter.char, letter.type)

A reader following the description literally would reasonably write Tile(guess.char, guess.type) — which does not compile, since guess has no .char or .type fields.

Steps to reproduce

  1. Read the challenge description in step 4.
  2. Attempt the challenge based solely on the description.
  3. Write Tile(guess.char, guess.type) as the text implies.
  4. Observe a compile error — the solution requires a nested loop not mentioned in the description.

Expected fix

Replace the sentence with something like:

"Each element of guess is a record with the type ({String char, HitType type}). Use a nested loop to iterate over the letters in each guess."

Additional context

No response

I would like to fix this problem.

  • I will try and fix this problem on docs.flutter.dev.

Metadata

Metadata

Assignees

No one assigned

    Labels

    from.page-issueReported in a reader-filed concern

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions