@@ -4,15 +4,15 @@ suite("ItemBuilder Tests", function () {
44
55 test ( "basic" , function ( ) {
66 const xml = `
7- <ListView :use="builder" :itemBuilder="item of component.items">
7+ <ListView :use="builder" :itemBuilder="int item of component.items">
88 <Text text="item.title" />
99 </ListView>
1010` ;
1111
1212 const expected = `
1313 ListView.builder(
1414 itemBuilder: (BuildContext context, int index) {
15- final item = component.items == null || component.items.length <= index || component.items.length == 0 ? null : component.items[index];
15+ final int item = component.items == null || component.items.length <= index || component.items.length == 0 ? null : component.items[index];
1616 return Text(
1717 item.title,
1818 );
@@ -27,15 +27,15 @@ suite("ItemBuilder Tests", function () {
2727
2828 test ( "with specified index" , function ( ) {
2929 const xml = `
30- <ListView :use="builder" :itemBuilder="myIndex, item of component.items">
30+ <ListView :use="builder" :itemBuilder="myIndex, ItemModel item of component.items">
3131 <Text text="item.title" />
3232 </ListView>
3333` ;
3434
3535 const expected = `
3636 ListView.builder(
3737 itemBuilder: (BuildContext context, int myIndex) {
38- final item = component.items == null || component.items.length <= myIndex || component.items.length == 0 ? null : component.items[myIndex];
38+ final ItemModel item = component.items == null || component.items.length <= myIndex || component.items.length == 0 ? null : component.items[myIndex];
3939 return Text(
4040 item.title,
4141 );
@@ -49,7 +49,7 @@ suite("ItemBuilder Tests", function () {
4949
5050 test ( "with stream" , function ( ) {
5151 const xml = `
52- <ListView :use="builder" :itemBuilder="item of component.items | stream">
52+ <ListView :use="builder" :itemBuilder="ItemModel item of component.items | stream">
5353 <Text text="item.title" />
5454 </ListView>
5555` ;
@@ -65,7 +65,7 @@ suite("ItemBuilder Tests", function () {
6565 }
6666 return ListView.builder(
6767 itemBuilder: (BuildContext context, int index) {
68- final item = componentItemsValue == null || componentItemsValue.length <= index || componentItemsValue.length == 0 ? null : componentItemsValue[index];
68+ final ItemModel item = componentItemsValue == null || componentItemsValue.length <= index || componentItemsValue.length == 0 ? null : componentItemsValue[index];
6969 return Text(
7070 item.title,
7171 );
@@ -188,7 +188,7 @@ suite("ItemBuilder Tests", function () {
188188 test ( "itemBuilder element" , function ( ) {
189189 const xml = `
190190 <ListView :use="builder">
191- <itemBuilder data="item of component.items">
191+ <itemBuilder data="ItemModel item of component.items">
192192 <Text text="item.title" />
193193 </itemBuilder>
194194 </ListView>
@@ -197,7 +197,7 @@ suite("ItemBuilder Tests", function () {
197197 const expected = `
198198 ListView.builder(
199199 itemBuilder: (BuildContext context, int index) {
200- final item = component.items == null || component.items.length <= index || component.items.length == 0 ? null : component.items[index];
200+ final ItemModel item = component.items == null || component.items.length <= index || component.items.length == 0 ? null : component.items[index];
201201 return Text(
202202 item.title,
203203 );
0 commit comments