fromDynamicMapWithKey<T> static method

Map<String, T> fromDynamicMapWithKey<T>(
  1. dynamic map,
  2. JsonClassWithKeyBuilder<T> builder
)

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,
) {
  final result = maybeFromDynamicMapWithKey(map, builder);

  if (result == null) {
    throw Exception(
      'Requested non-nullable fromDynamicMapWithKey but null was encountered.',
    );
  }

  return result;
}