deserialize static method

Descendant deserialize(
  1. Map<String, String> json,
  2. DeserializeFinderFactory finderFactory, {
  3. String? path,
})

Deserializes the finder from JSON generated by serialize.

Implementation

static Descendant deserialize(
  Map<String, String> json,
  DeserializeFinderFactory finderFactory, {
  String? path,
}) {
  final String? of = json['of'];
  if (of == null) {
    throw ArgumentError.notNull(path == null ? 'of' : '$path.of');
  }
  final String? matching = json['matching'];
  if (matching == null) {
    throw ArgumentError.notNull(path == null ? 'matching' : '$path.matching');
  }
  final Map<String, String> jsonOfMatcher = Map<String, String>.from(
    jsonDecode(of) as Map<String, dynamic>,
  );
  final Map<String, String> jsonMatchingMatcher = Map<String, String>.from(
    jsonDecode(matching) as Map<String, dynamic>,
  );
  return Descendant(
    of: finderFactory.deserializeFinder(jsonOfMatcher, path: path == null ? 'of' : '$path.of'),
    matching: finderFactory.deserializeFinder(
      jsonMatchingMatcher,
      path: path == null ? 'matching' : '$path.matching',
    ),
    matchRoot: json['matchRoot'] == 'true',
    firstMatchOnly: json['firstMatchOnly'] == 'true',
  );
}