How to remove items from a Dart List while iterating over it without a ConcurrentModificationError
Calling remove inside a for-in loop or forEach throws ConcurrentModificationError. Use removeWhere for in-place filtering, build a new list with where or a collection-for, or loop backwards by index. Verified on Dart 3.13.7, with a benchmark of why removeAt in a loop is the slow option.