I am not able to access the outer for loop counter in inner for loop
Any idea on how to do this ?
class buildsubcategories extends StatelessWidget {
List<cate.Categories> scat;
buildsubcategories(this.scat);
@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
for (int i = 0; i < scat.length; i++) Text(scat[i].categoryname),
Column(
children: <Widget>[
for (int j = 0; j < scat.length; j++)
Text(scat[i].subcategory[j]['subcategoryname'].toString())
],
)
],
);
}
```}
Expected Result : Able to access the variable i in the inner for loop
import 'package:flutter/material.dart'; class Categories { Categories( {@required this.categoryname, @required this.categoryImage, @required this.subcategory}); String categoryname; String categoryImage; List<dynamic> subcategory; Categories.fromMap(Map<dynamic, dynamic> map) { this.categoryname = map['name']; this.categoryImage = map['imageurl']; this.subcategory = map['subcategory']; }}