setPath method

bool setPath(
  1. String path,
  2. Object? value, {
  3. String delimiter = '.',
  4. bool parseIndices = true,
})

Writes a value into a nested map using path (e.g., "a.b.c").

Returns true if the value was set successfully.

Implementation

bool setPath(
  String path,
  Object? value, {
  String delimiter = '.',
  bool parseIndices = true,
}) {
  final segments = _splitPathSegments(
    path,
    delimiter,
    parseIndices: parseIndices,
  );
  if (segments.isEmpty) return false;
  return _setPathSegments(this, segments, value, parseIndices: parseIndices);
}