MapMC<K, V> class
abstract
A MapModel that also satisfies MCP.
Use as the base class when the model is the underlying map (e.g. InitializeResult, ClientCapabilities).
- Implemented types
- Available extensions
Properties
-
data
→ Map<
K, V> -
The underlying map data.
finalinherited
-
entries
→ Iterable<
MapEntry< K, V> > -
The map entries of this Map.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isEmpty → bool
-
Whether there is no key/value pair in the map.
no setterinherited
- isNotEmpty → bool
-
Whether there is at least one key/value pair in the map.
no setterinherited
-
keys
→ Iterable<
K> -
The keys of this Map.
no setterinherited
- length → int
-
The number of key/value pairs in the map.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
values
→ Iterable<
V> -
The values of this Map.
no setterinherited
Methods
-
add(
MapEntry< K, V> entry) → void - Adds a single entry to the map.
-
addAll(
Map< K, V> other) → void -
Adds all key/value pairs of
otherto this map.inherited -
addEntries(
Iterable< MapEntry< newEntries) → voidK, V> > -
Adds all key/value pairs of
newEntriesto this map.inherited -
asAny(
String key, {required dynamic def}) → dynamic -
Available on Map, provided by the MapFormatHelper extension
Retrieves the value associated with thekey. If the key does not exist, returns thedefvalue. -
asBool(
String key, {dynamic def = false}) → bool -
Available on Map, provided by the MapFormatHelper extension
Retrieves the boolean value associated with thekey. If the key does not exist or the value cannot be parsed as a boolean, returns thedefvalue. -
asDouble(
String key, {double def = 0}) → double -
Available on Map, provided by the MapFormatHelper extension
Retrieves the double value associated with thekey. If the key does not exist or the value cannot be parsed as a double, returns thedefvalue. -
asEnum<
T> (String key, List< T> enumValues, {required T def, String stringCleaner(String data)?}) → T -
Available on Map, provided by the MapFormatHelper extension
Retrieves an enum value of typeTassociated with thekey. If the key does not exist or the value cannot be parsed as an enum, returns thedefvalue. -
asInt(
String key, {int def = 0}) → int -
Available on Map, provided by the MapFormatHelper extension
Retrieves the integer value associated with thekey. If the key does not exist or the value cannot be parsed as an integer, returns thedefvalue. -
asList<
T> (String key, {List< T> ? def}) → List<T> -
Available on Map, provided by the MapFormatHelper extension
Retrieves the list of typeTassociated with thekey. If the key does not exist or the value cannot be parsed as a list, returns thedefvalue. -
asListModel<
T> (String key, T delegate(dynamic data), {List< T> ? def}) → List<T> -
Available on Map, provided by the MapFormatHelper extension
Retrieves a list of models of typeTfrom the map, using a provided delegate function to parse each item. -
asListModelLess<
T> (String key, T delegate(ModelLess data), {List< T> ? def}) → List<T> -
Available on Map, provided by the MapFormatHelper extension
Retrieves a list of models of typeTfrom the map usingModelLessinstances and a provided delegate function to parse each item. -
asMap<
T, K> (String key, {Map< T, K> ? def}) → Map<T, K> -
Available on Map, provided by the MapFormatHelper extension
Retrieves the map of typeTtoKassociated with thekey. If the key does not exist or the value cannot be parsed as a map, returns thedefvalue. -
asNum(
String key, {num def = 0}) → num -
Available on Map, provided by the MapFormatHelper extension
Retrieves the numeric value associated with thekey. If the key does not exist or the value cannot be parsed as a number, returns thedefvalue. -
asRegex(
String key, {String def = r'(\w+)', bool isBase64 = true, bool multiline = true}) → RegExp -
Available on Map, provided by the MapFormatHelper extension
Retrieves a regular expression pattern from the map associated with thekey. If the key does not exist or the value cannot be parsed as a regex, returns thedefvalue. -
asString(
String key, {String def = ''}) → String -
Available on Map, provided by the MapFormatHelper extension
Retrieves the string value associated with thekey. If the key does not exist, returns thedefvalue. -
cast<
RK, RV> () → Map< RK, RV> -
Provides a view of this map as having
RKkeys andRVinstances, if necessary.inherited -
clear(
) → void -
Removes all entries from the map.
inherited
-
containsKey(
Object? key) → bool -
Whether this map contains the given
key.inherited -
containsValue(
Object? value) → bool -
Whether this map contains the given
value.inherited -
forEach(
void action(K key, V value)) → void -
Applies
actionto each key/value pair of the map.inherited -
joinMap(
String separator, String separatorEntries) → String -
Available on Map, provided by the ConvertMap extension
Joins the map entries into a single string with specified separators. This method iterates over the map's entries and joins them into a single string. Each key-value pair is joined usingseparator, and each entry is separated byseparatorEntries.separatoris used to separate keys and values in each entry.separatorEntriesis used to separate each key-value pair. Returns a String representing the joined map entries. -
map<
K2, V2> (MapEntry< K2, V2> convert(K key, V value)) → Map<K2, V2> -
Returns a new map where all entries of this map are transformed by
the given
convertfunction.inherited -
Available on Map<
Navigates through the map using the provided path and retrieves a value of typeString, dynamic> , provided by the MapPath extensionT. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
putIfAbsent(
K key, V ifAbsent()) → V -
Look up the value of
key, or add a new entry if it isn't there.inherited -
remove(
Object? key) → V? -
Removes
keyand its associated value, if present, from the map.inherited -
removeAll(
List< K> keys) → Map<K, V> -
Available on Map<
Removes all entries with keys that are in the providedK, V> , provided by the MapTools extensionkeyslist. -
removeNulls(
) → void -
Available on Map, provided by the MapFormatHelper extension
remove all null values from the map. -
removeWhere(
bool test(K key, V value)) → void -
Removes all entries of this map that satisfy the given
test.inherited -
select(
List< K> selectKeys) → Map<K, V> -
Available on Map<
Selects all entries from the map whose keys are in the providedK, V> , provided by the MapTools extensionselectKeyslist. -
toMap(
) → Map< String, Object?> -
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
K key, V update(V value), {V ifAbsent()?}) → V -
Updates the value for the provided
key.inherited -
updateAll(
V update(K key, V value)) → void -
Updates all values.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
Object? key) → V? -
The value for the given
key, ornullifkeyis not in the map.inherited -
operator []=(
K key, V value) → void -
Associates the
keywith the givenvalue.inherited