Contact: aviboots(AT)netvision.net.il
39,890 questions
51,821 answers
573 users
void main() { final lst = ['a', 'b', 'c', 'd']; lst.asMap().forEach((i, v) { print('index = $i value = $v'); }); } /* run: index = 0 value = a index = 1 value = b index = 2 value = c index = 3 value = d */
void main(){ final lst = ['a', 'b', 'c', 'd']; for (var i = 0; i < lst.length; i++) { print('index = $i value = ${lst[i]}'); } } /* run: index = 0 value = a index = 1 value = b index = 2 value = c index = 3 value = d */
import 'package:collection/collection.dart'; void main() { final lst = ['a', 'b', 'c', 'd']; lst.forEachIndexed((i, v) { print('index = $i value = $v'); }); } /* run: index = 0 value = a index = 1 value = b index = 2 value = c index = 3 value = d */