deserialize method Null safety

Ancestor deserialize(
  1. Map<String, String> json,
  2. DeserializeFinderFactory finderFactory
)

Deserializes the finder from JSON generated by serialize.

Implementation

static Ancestor deserialize(Map<String, String> json, DeserializeFinderFactory finderFactory) {
  final Map<String, String> jsonOfMatcher =
      Map<String, String>.from(jsonDecode(json['of']!) as Map<String, dynamic>);
  final Map<String, String> jsonMatchingMatcher =
      Map<String, String>.from(jsonDecode(json['matching']!) as Map<String, dynamic>);
  return Ancestor(
    of: finderFactory.deserializeFinder(jsonOfMatcher),
    matching: finderFactory.deserializeFinder(jsonMatchingMatcher),
    matchRoot: json['matchRoot'] == 'true',
    firstMatchOnly: json['firstMatchOnly'] == 'true',
  );
}