Commit 01f9a8a 1 parent 976ed7e commit 01f9a8a Copy full SHA for 01f9a8a
File tree 1 file changed +11
-6
lines changed
1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -107,22 +107,27 @@ Let's customize the app you just created.
107
107
``` dart
108
108
Iterable<String> thingsTodo() sync* { ... }
109
109
110
- [!LIElement newLI(String itemText) => LIElement()..text = itemText;!]
111
-
110
+ [!HTMLLIElement newLI(String itemText) =>
111
+ (document.createElement('li') as HTMLLIElement)..text = itemText;!]
112
+
112
113
void main() { ... }
113
114
```
114
115
115
- 3 . In the ` main() ` function, initialize the ` output ` element using
116
+ 3 . In the ` main() ` function, append content to the ` output ` element using
116
117
` thingsTodo() ` :
117
118
118
119
``` dart
119
120
Iterable<String> thingsTodo() sync* { ... }
120
121
121
- LIElement newLI(String itemText) => LIElement()..text = itemText;
122
+ HTMLLIElement newLI(String itemText) =>
123
+ (document.createElement('li') as HTMLLIElement)..text = itemText;
122
124
123
125
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
+ }
126
131
```
127
132
128
133
4 . Save your changes.
You can’t perform that action at this time.
0 commit comments