How acces to the values of a Set
448
Solution 1
I didn't get the clarity of what you mean by accessing next set but, you can access your current set data in following ways.
Set mySet = Set.from(['Please', 'Help', 'Me']); // declaration.
Accessing through index
print('mySet.elementAt(0): ${mySet.elementAt(0)}');
print('mySet.elementAt(1): ${mySet.elementAt(1)}');
print('mySet.elementAt(2): ${mySet.elementAt(2)}');
Iterating over set.
mySet.forEach((value) => {print(value)});
Logging to see data stored in current set.
print('mySet: ${mySet.toString()}');
Solution 2
From Wikipedia:
Unlike most other collection types, rather than retrieving a specific element from a set, one typically tests a value for membership in a set.
That is, if this is not possible (to acces to the values) then this does not mean that this data structure does not fulfill its purpose.
Maybe you should choose a different, and at the same time, more suitable, for your purposes, data structure?
Author by
Alexis Olveres
Updated on December 10, 2022Comments
-
Alexis Olveres over 1 year
I'am a begginer in Dart and i dont know how to acces to the values of the next Set
Set mySet = Set.from(['Please', 'Help', 'Me']);
-
Kalpesh Kundanani about 5 yearsWhat do you mean by accessing value of next set ??
-
-
Alexis Olveres about 5 yearsThank you for this information, it had been difficult to understand what paper was already playing in difference between with List
-
Alexis Olveres about 5 yearsYou have solved my doubt in an excellent way. Thank you! This is just what I needed.