Skip to content

Instantly share code, notes, and snippets.

@ParMiKyaung
Last active April 27, 2020 05:06
Show Gist options
  • Save ParMiKyaung/8adb225dba1c486a27b69463a6e06596 to your computer and use it in GitHub Desktop.
Save ParMiKyaung/8adb225dba1c486a27b69463a6e06596 to your computer and use it in GitHub Desktop.
List type of string
void main() {
List<String> myList = [
'Zarni',
'Say May',
'Puu Lay',
'Bling',
];
//print(myList.first); //output - Zarni
//print(myList.last); //output - Bling
//print(myList[myList.length - 2]); //output - Puu Lay
//print(myList); //output - [Zarni, Say May, Puu Lay, Bling]
//print(myList[2]); //output - Puu Lay
//print(myList.indexOf('Bling')); //output - 3
//myList.add('Wat Ka Lay');
//print(myList); //output - [Zarni, Say May, Puu Lay, Bling, Wat Ka Lay]
//myList.insert(2, 'Wat ka lay');
//print(myList); //output - [Zarni, Say May, Wat ka lay, Puu Lay, Bling]
//myList[0] = 'Saw Zarni Lin Htay';
//print(myList); //output - [Saw Zarni Lin Htay, Say May, Puu Lay, Bling]
//myList.remove('Bling');
//print(myList); //output - [Zarni, Say May, Puu Lay]
//myList.removeAt(2);
//print(myList); //output - [Zarni, Say May, Bling]
//print(myList.length); //output - 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment