unflatten method
Rebuilds a nested map from a flattened map.
Keys are split by delimiter to create nested structures.
Numeric segments are treated as list indices when parseIndices is true.
Implementation
Map<String, Object?> unflatten({
String delimiter = '.',
bool parseIndices = true,
}) {
final result = <String, Object?>{};
for (final entry in entries) {
final segments = _splitPathSegments(
entry.key,
delimiter,
parseIndices: parseIndices,
);
if (segments.isEmpty) continue;
_setPathSegments(
result,
segments,
entry.value,
parseIndices: parseIndices,
);
}
return result;
}