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
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 - Adds a single entry to the map.
-
addAll(
Map< K, V> other) → void -
See Map.addAll.
inherited
-
addEntries(
Iterable< MapEntry< newEntries) → voidK, V> > -
See Map.addEntries.
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> -
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 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> -
See Map.map.
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 -
See Map.putIfAbsent.
inherited
-
remove(
Object? key) → V? -
See Map.remove.
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 -
See Map.removeWhere.
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?> -
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