singleSemanticNode method

DebugCaptureSemanticNode singleSemanticNode({
  1. String? role,
  2. String? label,
  3. Object? value,
  4. bool? focused,
  5. bool? selected,
  6. String? action,
  7. Map<String, Object?> stateContains = const <String, Object?>{},
})

Implementation

DebugCaptureSemanticNode singleSemanticNode({
  String? role,
  String? label,
  Object? value,
  bool? focused,
  bool? selected,
  String? action,
  Map<String, Object?> stateContains = const <String, Object?>{},
}) {
  final matches = semanticNodes(
    role: role,
    label: label,
    value: value,
    focused: focused,
    selected: selected,
    action: action,
    stateContains: stateContains,
  ).toList(growable: false);
  if (matches.length != 1) {
    throw StateError(
      'Expected exactly one debug-capture semantic node, found '
      '${matches.length}.',
    );
  }
  return matches.single;
}