// ordered group of objectsvarlist=[1,2,3];print(list.length);//Print: 3print(list[1]);//Print: 2// other ways of list declaration and initializationsList<String>cities=<String>["New York","Mumbai","Tokyo"];// To create a list that’s a compile-time constantconstconstantCities=const["New York","Mumbai","Tokyo"];
Sets
// A set in Dart is an unordered collection of unique items.varhalogens={'fluorine','chlorine','bromine','iodine','astatine'};// to create an empty setvarnames=<String>{};Set<String>names={};// This works, too.//var names = {}; // Creates a map, not a set.
Maps
// a map is an object that associates keys and valuesvarperson=Map<String,String>();// To initialize the map, do this:person['lastName']='Tesla';print(person);//Print: {firstName: Nicola, lastName: Tesla}print(person['lastName']);//Print: TeslavarnobleGases={// Key: Value2:'helium',10:'neon',18:'argon',};