deserializeFinder method

SerializableFinder deserializeFinder(
  1. Map<String, String> json, {
  2. String? path,
})

Deserializes the finder from JSON generated by SerializableFinder.serialize.

The path is the current path to the json object from the parent object.

Implementation

SerializableFinder deserializeFinder(Map<String, String> json, {String? path}) {
  final String? finderType = json['finderType'];
  if (finderType == null) {
    throw ArgumentError.notNull(path == null ? 'finderType' : '$path.finderType');
  }
  return switch (finderType) {
    'ByType' => ByType.deserialize(json, path: path),
    'ByValueKey' => ByValueKey.deserialize(json, path: path),
    'ByTooltipMessage' => ByTooltipMessage.deserialize(json, path: path),
    'BySemanticsLabel' => BySemanticsLabel.deserialize(json, path: path),
    'ByText' => ByText.deserialize(json, path: path),
    'PageBack' => const PageBack(),
    'Descendant' => Descendant.deserialize(json, this, path: path),
    'Ancestor' => Ancestor.deserialize(json, this, path: path),
    _ => throw DriverError('Unsupported search specification type $finderType'),
  };
}