LMap class

A class that provides a map with a default value for missing keys.

This class wraps a standard Map and provides an operator to access map values. If a key is not found in the map, it returns a default value. If the default value is a String, it can include a placeholder @key that will be replaced with the missing key.

Example usage:

var lmap = LMap({
  'name': 'John Doe',
  'age': 30
}, def: 'Unknown');

print(lmap['name']); // Outputs: John Doe
print(lmap['address']); // Outputs: Unknown

In the example above, the default value 'Unknown' is used for missing keys. If you provide a String as the default value containing @key, it will be replaced with the missing key.

Constructors

LMap(Map<String, Object?> map, {Object? def})

Properties

def Object?
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
map Map<String, Object?>
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](String key) Object?