Loading topic
List, Map, and Set. Each one has a literal syntax, which is a way to write the collection directly in your source code. This chapter covers what each type is for, how to create it, how type inference treats literals, and the mistakes that trip people5 min readList is Dart's most common collection. It holds elements in a fixed order, and each element has an integer position called an index. This chapter assumes you know basic Dart syntax, generics notation such as List<int>, and the idea of a nullable type. Null-safe lookups, spread, sorting, and co4 min readMap stores key-value pairs and finds a value from its key without scanning every entry. This chapter assumes you know basic Dart syntax, generic notation such as List<int>, and nullable types such as int?. It builds on the overview of the three core collections.4 min readList<int> and what a nullable type like int? means. You have already seen lists and maps, so this chapter focuses on what makes a set different and on the op5 min readint? allows null and int does not, and how ??, ?., and ! work on a single value. It also assumes you can read List<int>, Map<String, int>, and Set<int>. Here you will see where null shows up when you work with collecti4 min readList<int>, and nullable types such as int?. You should also have met lists, maps, and sets. The chapter covers the ways to visit every element of a collection, what Iterable is, and the errors that come from iterating carelessly5 min readList<int> and Map<String, int>. You should also know how null safety marks types such as int?. Here you will learn to build a collection in a single literal, without a separate loop that calls add.5 min readList<int>, write closures like (n) => n * 2, and have seen for-in loops over lists. You will learn how where, map, fold, and toList fit together, why most of them are lazy, and which mistakes they cause most often.4 min readList<int>, and handle nullable types such as int?. It also assumes you know the where, map, and toList methods from the previous chapter, and 6 min readfinal means and what an exception is. Here you will learn which operations a Dart collection allows. Two collections can have the same type, List<int>, and still di5 min read...), and read generic types such as List<int>. By the end you will know which copy methods Dart offers, what "shallow" means, and how to copy nested data safely.4 min readSet and Map literals behave from the earlier chapters. Here you will learn how Set and Map decide that two objects are "the same". You will also see how to make your own classes work cor5 min readSplayTreeMap and SplayTreeSet. It assumes you can write basic Dart, read generics such as Map<String, int>, and already know how to create lists, maps, and sets. You should als5 min readList<int>, and with nullable types such as int?. It builds on the earlier chapters about equality and hashCode, and about ordering guarantees.5 min read