Flutter : Avoid using `forEach` with a function literal

Solution 1:

AVOID using forEach with a function literal.

BAD:

snapshot.docs.forEach((document) {
  ...
});

GOOD:

for (var document in snapshot.docs) {
  // Rest of your code
}