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. DiscoverResult, ClientCapabilities).

Implemented types
Available extensions

Constructors

MapMC(Map<K, V> data)
Creates a MapMC.

Properties

data Map<K, V>
The underlying map data.
finalinherited
entries Iterable<MapEntry<K, V>>
See Map.entries.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
isEmpty bool
See Map.isEmpty.
no setterinherited
isNotEmpty bool
See Map.isNotEmpty.
no setterinherited
keys Iterable<K>
See Map.keys.
no setterinherited
length int
See Map.length.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
values Iterable<V>
See Map.values.
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
See Map.addAll.
inherited
addEntries(Iterable<MapEntry<K, V>> newEntries) → void
See Map.addEntries.
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>
See Map.cast.
inherited
clear() → void
See Map.clear.
inherited
containsKey(Object? key) bool
See Map.containsKey.
inherited
containsValue(Object? value) bool
See Map.containsValue.
inherited
forEach(void action(K key, V value)) → void
See Map.forEach.
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>
See Map.map.
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
See Map.putIfAbsent.
inherited
remove(Object? key) → V?
See Map.remove.
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
See Map.removeWhere.
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?>
Converts this object into a JSON-compatible map.
inherited
toString() String
A string representation of this object.
inherited
update(K key, V update(V value), {V ifAbsent()?}) → V
See Map.update.
inherited
updateAll(V update(K key, V value)) → void
See Map.updateAll.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](Object? key) → V?
Delegates to the underlying map's [] operator.
inherited
operator []=(K key, V value) → void
Delegates to the underlying map's []= operator.
inherited