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

Popular posts from this blog

Second GET API Calling with Bloc simple Example in Flutter

Stack Container Scrollable Card widget UI with Custom Widget

Pagination with Bloc Pattern in Flutter