fromDynamicMapWithKey<T> static method
Helper function to create a map
of string keys to dynamic objects given
a builder
that can build a single object with the key from the incoming
map being passed to the builder.
Implementation
static Map<String, T>? fromDynamicMapWithKey<T>(
dynamic map,
JsonClassWithKeyBuilder<T> builder,
) {
Map<String, T>? result;
if (map != null) {
result = {};
for (var entry in map.entries) {
result[entry.key] = builder(
entry.value,
key: entry.key,
);
}
}
return result;
}