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

Constructors

MapMC(Map<K, V> data)

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

Available on Map<K, V>, provided by the MapTools extension

Adds a single entry to the map.
addAll(Map<K, V> other) → void
Adds all key/value pairs of other to this map.
inherited
addEntries(Iterable<MapEntry<K, V>> newEntries) → void
Adds all key/value pairs of newEntries to this map.
inherited
asAny(String key, {required dynamic def}) → dynamic

Available on Map, provided by the MapFormatHelper extension

Retrieves the value associated with the key. If the key does not exist, returns the def value.
asBool(String key, {dynamic def = false}) bool

Available on Map, provided by the MapFormatHelper extension

Retrieves the boolean value associated with the key. If the key does not exist or the value cannot be parsed as a boolean, returns the def value.
asDouble(String key, {double def = 0}) double

Available on Map, provided by the MapFormatHelper extension

Retrieves the double value associated with the key. If the key does not exist or the value cannot be parsed as a double, returns the def value.
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 type T associated with the key. If the key does not exist or the value cannot be parsed as an enum, returns the def value.
asInt(String key, {int def = 0}) int

Available on Map, provided by the MapFormatHelper extension

Retrieves the integer value associated with the key. If the key does not exist or the value cannot be parsed as an integer, returns the def value.
asList<T>(String key, {List<T>? def}) List<T>

Available on Map, provided by the MapFormatHelper extension

Retrieves the list of type T associated with the key. If the key does not exist or the value cannot be parsed as a list, returns the def value.
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 type T from 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 type T from the map using ModelLess instances 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 type T to K associated with the key. If the key does not exist or the value cannot be parsed as a map, returns the def value.
asNum(String key, {num def = 0}) num

Available on Map, provided by the MapFormatHelper extension

Retrieves the numeric value associated with the key. If the key does not exist or the value cannot be parsed as a number, returns the def value.
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 the key. If the key does not exist or the value cannot be parsed as a regex, returns the def value.
asString(String key, {String def = ''}) String

Available on Map, provided by the MapFormatHelper extension

Retrieves the string value associated with the key. If the key does not exist, returns the def value.
cast<RK, RV>() Map<RK, RV>
Provides a view of this map as having RK keys and RV instances, 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 action to 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 using separator, and each entry is separated by separatorEntries. separator is used to separate keys and values in each entry. separatorEntries is 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 convert function.
inherited

Available on Map<String, dynamic>, provided by the MapPath extension

Navigates through the map using the provided path and retrieves a value of type T.
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 key and its associated value, if present, from the map.
inherited
removeAll(List<K> keys) Map<K, V>

Available on Map<K, V>, provided by the MapTools extension

Removes all entries with keys that are in the provided keys list.
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<K, V>, provided by the MapTools extension

Selects all entries from the map whose keys are in the provided selectKeys list.
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, or null if key is not in the map.
inherited
operator []=(K key, V value) → void
Associates the key with the given value.
inherited