What is a List in Dart?
List is a part of a Collection in dart it is used to store multiple data or similar data types whether it can be in integer, boolean, or String or user-defined data type.
Let me explain with an example. I am storing students roll number But it can store only 1 student’s data
Suppose I want to store roll numbers of all the students, we cannot create a number of variable names
rollNo1,rollNo2 and so on. So here I am going to use a
List, List is used to store many values of similar data types. Here I can put all the students roll a number of any number of lengths.
The number of items in the list a dynamic nature which means you can add or remove elements at any point of execution. In example you can see there are 4 items but any programming languages always count it as 0-3 i.e the index of will be 0, not 1, but the length same- 4.
If I want to access an element from the list I have to mention the list variable name with an index number, so to get
34 from the
List the sentence will be: