Variable does not change the value inside the construct

44 Views Asked by At

I'm using flutterflow functions, and I need to iterate through a list of inp, and I encountered a problem reading this list, I simplified the function to show where it stops working, I'm new to flutterflow, this is the only way I found.

int someFunction(List<DocumentReference> inp) {
    
  int needToChange = 0;
  
  for (DocumentReference docRef in inp) {
    needToChange = 13; //change
    docRef.get().then((DocumentSnapshot snapshot) {
      needToChange = 13; //not change
  
      Map<String, dynamic> data = snapshot.data() as Map<String, dynamic>;
  
    });
  }
  return needToChange;
}
0

There are 0 best solutions below