Skip to content

Commit 01f9a8a

Browse files
committed
fix code sample
1 parent 976ed7e commit 01f9a8a

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/content/web/get-started.md

+11-6
Original file line numberDiff line numberDiff line change
@@ -107,22 +107,27 @@ Let's customize the app you just created.
107107
```dart
108108
Iterable<String> thingsTodo() sync* { ... }
109109
110-
[!LIElement newLI(String itemText) => LIElement()..text = itemText;!]
111-
110+
[!HTMLLIElement newLI(String itemText) =>
111+
(document.createElement('li') as HTMLLIElement)..text = itemText;!]
112+
112113
void main() { ... }
113114
```
114115

115-
3. In the `main()` function, initialize the `output` element using
116+
3. In the `main()` function, append content to the `output` element using
116117
`thingsTodo()`:
117118

118119
```dart
119120
Iterable<String> thingsTodo() sync* { ... }
120121
121-
LIElement newLI(String itemText) => LIElement()..text = itemText;
122+
HTMLLIElement newLI(String itemText) =>
123+
(document.createElement('li') as HTMLLIElement)..text = itemText;
122124
123125
void main() {
124-
querySelector('#output')?[!.children.addAll(thingsTodo().map(newLI));!]
125-
}
126+
final output = querySelector('#output');
127+
[!for (final item in thingsTodo()) {
128+
output?.appendChild(newLI(item));
129+
}!]
130+
}
126131
```
127132

128133
4. Save your changes.

0 commit comments

Comments
 (0)