The Problem with Traditional Finders
Let’s look at a typical Flutter widget test using traditional finders:pumpAndSettle() calls and verbose find.byKey() syntax.
The Patrol Solution
Here’s the same test using Patrol’s custom finders:Key Benefits
Concise Syntax
The
$ operator replaces verbose find.byKey(), find.byType(), and other finder methodsAutomatic Waiting
Actions like
tap() and enterText() automatically wait for widgets to become visibleChainable Finders
Easily express complex widget hierarchies with chainable syntax
Smart Pumping
Built-in frame rendering eliminates manual
pumpAndSettle() callsWhat You Can Find
Patrol’s$ operator is incredibly flexible. It accepts multiple types:
| Type | Example | Flutter Equivalent |
|---|---|---|
| Text | $('Log in') | find.text('Log in') |
| Widget Type | $(TextField) | find.byType(TextField) |
| Symbol (Key) | $(#emailInput) | find.byKey(Key('emailInput')) |
| Key | $(Key('emailInput')) | find.byKey(Key('emailInput')) |
| Icon | $(Icons.add) | find.byIcon(Icons.add) |
| Pattern | $(RegExp('Log.*')) | find.textContaining(RegExp('Log.*')) |
| Widget | $(myWidget) | find.byWidget(myWidget) |
| Finder | $(find.text('Hi')) | find.text('Hi') |
Platform Support
Beyond Basic Finding
Patrol finders aren’t just about finding widgets—they’re about interacting with them naturally:What’s Next?
Setup
Add
patrol_finders to your project and configure your first testGo to Setup →Basic Usage
Learn how to find widgets, make assertions, and perform actionsGo to Usage →
Advanced Techniques
Master complex scenarios, chaining, and the
which() methodGo to Advanced →