List Simple
void main()
{
var listNames = [10, 20, 30, 40]; // List
listNames.add(50);
print("$listNames");
var names = []; // Blank List
names.add("Raman");
names.add("Ramanujan");
names.add("bhavesh");
names.add("pratik");
names.addAll(listNames); // Using addAll, we can add previous_List(here "listNames") in the Current_List(here "names")
names.insert(2, 300); // Use ".insert", To insert element(data) at any particular index of the List
print("$names");
}
/// OUTPUT:
/// [10, 20, 30, 40, 50]
/// [Raman, Ramanujan, 300, bhavesh, pratik, 10, 20, 30, 40, 50]
Comments
Post a Comment