resolve method

T resolve(
  1. Config config, {
  2. ConfigSpecContext? context,
})

Resolve a typed model from the current config.

Implementation

T resolve(Config config, {ConfigSpecContext? context}) {
  final resolvedContext = context ?? ConfigSpecContext(config: config);
  final rawValue = config.get<Object?>(root);
  final raw = rawValue == null
      ? const <String, dynamic>{}
      : _stringKeyedMap(rawValue, root);
  final merged = mergeDefaults(raw, context: resolvedContext);
  return fromMap(merged, context: resolvedContext);
}