getByText

TestNode getByText(

  1. String text, {
  2. bool exact = false,
})

Get a single node by text

Implementation

TestNode getByText(String text, {bool exact = false}) {
  final results = findByText(text, exact: exact);
  if (results.isEmpty) {
    throw TestingException('No node found with text: $text');
  }
  if (results.length > 1) {
    throw TestingException('Multiple nodes found with text: $text');
  }
  return results.first;
}