Programming in Dart: Fundamentals

Apr 26 2022 Dart 2.15, DartPad, DartPad

Part 2: Introducing Collections & Null Safety

11. Operate on a List

Episode complete

Play next episode

Next
Save for later
About this episode
See versions
See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 10. Create a List Next episode: 12. Challenge: Work with Lists

This video Operate on a List was last updated on Apr 26 2022

Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

You can unlock the rest of this video course, and our entire catalogue of books and videos, with a kodeco.com Professional subscription.

So you’ve learned how to create lists, and how to append elements to them, using the append method and the += operator.

const pastries = ['cookie', 'cupcake', 'donut', 'pie'];
print(pastries[0]);
print(pastries[100]);
var morePastries = pastries.sublist(1, 3);
print(morePastries);
morePastries.clear();
print(evenmMorePastries);
print(evenMorePastries.isEmpty);
print(pastries[0]);
print(pastries.first);
print(pastries.last);
print(pastries.length);
print(pastries.contains('cookie'));
print(pastries.contains('lasagna'));
var pastries = ['cookie', 'cupcake', 'donut', 'pie'];
pastries.add('brownie');
print(pastries);
pastries[4] = 'cream puff';
pastries.insert(1, 'tart');
print(pastries);
var pastry = pastries.removeAt(0);
print(pastry);