How to loop through two lists at the same time - Flutter

I'm trying to loop through two lists at the same time

For example

List A = ['Chapter 1','Chapter 2','Chapter 3'];
List B = ['Paragraph 1','Paragraph 2','Paragraph 3'];

for(var chapter in A)  // This would itreate through only first list (A), How can I iterate through both list
children: [
     Text(chapter);   
     Text(paragraph);
]

I need to iterate through both lists at the same time in "for" loop.


Solution 1:

Here is the code:

  List A = ['Chapter 1','Chapter 2','Chapter 3'];
  List B = ['Paragraph 1','Paragraph 2','Paragraph 3'];
  for (int i = 0; i < A.length; i++) {
      print ("${A[i]}");
      print ("${B[i]}");
  }

Let me know if this does not help.