testTag function

Widget testTag(
  1. String id,
  2. Widget child, {
  3. bool button = false,
  4. bool textField = false,
  5. bool enabled = true,
  6. bool container = false,
  7. String prefix = 'test',
})

Wraps child in a Semantics widget that exposes a deterministic accessibility label for end-to-end tests.

Implementation

Widget testTag(
  String id,
  Widget child, {
  bool button = false,
  bool textField = false,
  bool enabled = true,
  bool container = false,
  String prefix = 'test',
}) {
  return Semantics(
    label: '$prefix:$id',
    button: button,
    textField: textField,
    enabled: enabled,
    container: container,
    child: child,
  );
}