getSemanticsId method

Future<int> getSemanticsId(
  1. SerializableFinder finder, {
  2. Duration? timeout,
})

Retrieves the semantics node id for the object returned by finder, or the nearest ancestor with a semantics node.

Throws an error if finder returns multiple elements or a semantics node is not found.

Semantics must be enabled to use this method, either using a platform specific shell command or setSemantics.

Implementation

Future<int> getSemanticsId(SerializableFinder finder, { Duration? timeout }) async {
  final Map<String, dynamic> jsonResponse = await sendCommand(GetSemanticsId(finder, timeout: timeout));
  final GetSemanticsIdResult result = GetSemanticsIdResult.fromJson(jsonResponse);
  return result.id;
}