Skip to content

Instantly share code, notes, and snippets.

@Mufaddal1125
Created July 26, 2022 18:28
Show Gist options
  • Save Mufaddal1125/501c2e33c6415bd1782e637766e8bef9 to your computer and use it in GitHub Desktop.
Save Mufaddal1125/501c2e33c6415bd1782e637766e8bef9 to your computer and use it in GitHub Desktop.
create_keys
// list of fruits
var fruits = [
'Apple',
'Banana',
'Cherry',
'Grape',
'Kiwi',
'Mango',
'Orange',
'Pear',
'Strawberry',
'Watermelon',
'Elderberry',
'Eggfruit',
'Evergreen',
'Huckleberry',
'Entawak',
'Grapefruit',
'Grapes',
'Gooseberries',
'Guava',
'Honeydew',
'Kumquat',
'Lemon',
'Lime',
'Lychee',
'Mandarina',
'Mango',
];
// create list of global keys
List<GlobalKey> _fruitKeys = [];
@override
void initState() {
// add key for each fruit to _fruitKeys
_fruitKeys = fruits.map((e) => GlobalKey()).toList();
super.initState();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment