The type used by the Window.localStorage and Window.sessionStorage properties. Storage is implemented as a Map<String, String>.
To store and get values, use Dart's built-in map syntax:
window.localStorage['key1'] = 'val1';
window.localStorage['key2'] = 'val2';
window.localStorage['key3'] = 'val3';
assert(window.localStorage['key3'] == 'val3');
You can use Map APIs such as containsValue(), clear(), and length:
assert(window.localStorage.containsValue('does not exist') == false);
window.localStorage.clear();
assert(window.localStorage.length == 0);
For more examples of using this API, see localstorage_test.dart. For details on using the Map API, see the Maps section of the library tour.
other
to this map. [...]
key
. [...]
value
. [...]
f
to each key/value pair of the map. [...]
key
, or add a new value if it isn't there. [...]
key
and its associated value, if present, from the map. [...]
newEntries
to this map. [...]
RK
keys and RV
instances,
if necessary. [...]
f
function.
predicate
.
key
. [...]
key
or null if key
is not in the map. [...]
key
with the given value
. [...]