Junior — Middle
Can you name the main types of collections used in Dart?
sobes.tech AI
Answer from AI
In Dart, the main collection types are:
- List — an ordered list of elements, accessed by index.
- Set — an unordered collection of unique elements.
- Map — a collection of key-value pairs, where keys are unique.
Example usage:
var list = [1, 2, 3];
var set = {1, 2, 3};
var map = {'key1': 'value1', 'key2': 'value2'};