MapReader class

A utility class to safely read nested values from a Map using a separator.

Example:

final data = {
  "user": {
    "profile": {
      "name": "John Doe"
    }
  }
};

final name = MapReader.read<String>("user/profile/name", data);
print(name); // John Doe

Properties

hashCode int
The hash code for this object.
no setterinherited
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

Static Methods

read<T extends Object?>(String key, Map data, {String separator = "/"}) → T?
Safely reads a value of type T from a nested Map using key and separator.