-
Notifications
You must be signed in to change notification settings - Fork 22
StreamedMap
Francesco Mineo edited this page Mar 15, 2019
·
1 revision
This class has been created to work with maps, it works like [StreamedList]. To modify the list (e.g. adding items) and update the stream automatically, use these methods:
addKey
removeKey
clear
For other direct actions on the map, to update the stream call the refresh
method instead.
e.g. adding a key/value pair:
streamedMap.addKey(1, 'first');
it is the same as:
streamedMap.value[1] = 'first';
streamedList.refresh();
final streamedMap = StreamedMap<int, String>();
// Add to the streamed map the key/value pair put by the user
addText() {
var key = int.parse(streamedKey.value);
var value = streamedText.value;
streamedMap.addKey(key, value);
// Or, as an alternative:
//streamedMap.value[key] = value;
//streamedMap.refresh();
}