dart initializer list code example
Example 1: declaring and initializing a list in dart
import 'dart:core';
void main() {
//List of integers
List<int> intArr = [1,2,3,4,5];
print(intArr);
//List of strings
List<String> strArr = ['hello', 'world'];
print(strArr);
}
Example 2: Flutter Constructor
Customer(String name, int age, String location) {
this.name = name;
this.age = age;
this.location = location;
}
Customer(this.name, this.age) {
this.name = name;
this.age = age;
}