enable lint prefer_foreach (#12674)

* enable lint prefer_foreach

* fix tests
diff --git a/analysis_options_repo.yaml b/analysis_options_repo.yaml
index 0a50bfc..eacdb1a 100644
--- a/analysis_options_repo.yaml
+++ b/analysis_options_repo.yaml
@@ -113,7 +113,7 @@
     # - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods
     - prefer_final_fields
     - prefer_final_locals
-    # - prefer_foreach # not yet tested
+    - prefer_foreach
     # - prefer_function_declarations_over_variables # not yet tested
     - prefer_initializing_formals
     # - prefer_interpolation_to_compose_strings # not yet tested