forEach loop index dart code example Example: flutter foreach with index List _sample = ['a','b','c']; _sample.asMap().forEach((index, value) => f);