Patrol
Simple yet powerful Flutter-first UI testing framework overcoming limitations of
flutter_test, integration_test, and flutter_driver. Created and supported
by LeanCode.

Learn more about Patrol:
- Our extensive documentation
- How Patrol 4.0 Makes Cross-Platform Flutter Testing Possible
- Simplifying Flutter Web Testing: Patrol Web
- Patrol VS Code Extension - A Better Way to Run and Debug Flutter UI Tests
Patrol finders
patrol_finders is a streamlined, high-level API on top of flutter_test.
It provides a new custom finder system to make Flutter widget tests more concise and understandable, and writing them – faster and more fun.
Installation
$ dart pub add patrol_finders --dev
Documentation
Read our docs to learn more.
Custom finders
import 'package:example/main.dart';
import 'package:flutter/material.dart';
import 'package:patrol_finders/patrol_finders.dart';
void main() {
patrolWidgetTest(
'logs in successfully',
($) async {
await $.pumpWidgetAndSettle(const ExampleApp());
/// Finds widget with Key('emailInput') and enters text into it
///
await $(#emailInput).enterText('user@leancode.co');
/// Finds widget with Key('passwordInput') and enters text into it
await $(#passwordInput).enterText('ny4ncat');
// Finds all widgets with text 'Log in' which are descendants of widgets
// with Key('box1'), which are descendants of a Scaffold widget, and taps
// on the first 'Log in' text.
await $(Scaffold).$(#box1).$('Log in').tap();
// Finds all Scrollables which have Text descendant, and taps on the first
// Scrollable
await $(Scrollable).containing(Text).tap();
// Finds all Scrollables which have ElevatedButton descendant and Text
// descendant, and taps on the first Scrollable
await $(Scrollable).containing(ElevatedButton).containing(Text).tap();
// Finds all Scrollables which have TextButton descendant which has Text
// descendant, and taps on the first Scrollabke
await $(Scrollable).containing($(TextButton).$(Text)).tap();
},
);
}
🛠️ Maintained by LeanCode
This package is built with 💙 by LeanCode. We are top-tier experts focused on Flutter Enterprise solutions.
Why LeanCode?
-
Creators of Patrol – the next-gen testing framework for Flutter.
-
Production-Ready – We use this package in apps with millions of users.
-
Full-Cycle Product Development – We take your product from scratch to long-term maintenance.