Configuration.fromString constructor Null safety

Configuration.fromString(
  1. String contents
)

contents must be YAML.

Implementation

Configuration.fromString(String contents) {
  final yamlMap = loadYaml(contents) as Map<dynamic, dynamic>?;
  final map =
      yamlMap?.map<String, dynamic>((k, v) => MapEntry(k.toString(), v));
  decode(map);
}