PatrolFinder class
Patrol custom finder, also known as $
.
This is decorator around Finder that extends it with Patrol features, but also preserves Finder's behavior.
- Implemented types
Constructors
- PatrolFinder.new({required Finder finder, required PatrolTester tester})
-
Creates a new PatrolFinder with the given
finder
andtester
. - PatrolFinder.resolve({required dynamic matching, required Finder? parentFinder, required PatrolTester tester})
-
Returns a PatrolFinder that looks for
matching
in descendants ofparentFinder
. IfparentFinder
is null, it looks formatching
anywhere in the widget tree.factory
Properties
-
allCandidates
→ Iterable<
Element> -
Returns all of the items that will be considered by this finder.
no setteroverride
- description → String
-
Describes what the finder is looking for. The description should be
a brief English noun phrase describing the finder's requirements.
no setter
- exists → bool
-
Returns true if this finder finds at least 1 widget.
no setter
- finder → Finder
-
Finder that this PatrolFinder wraps.
final
- first → PatrolFinder
-
Returns a variant of this finder that only matches the first item
found by this finder.
no setteroverride
-
found
→ FinderResult<
Element> -
The results of the latest evaluate or tryEvaluate call.
no setteroverride
- hasFound → bool
-
Whether or not this finder has any results in found.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- last → PatrolFinder
-
Returns a variant of this finder that only matches the last item
found by this finder.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- skipOffstage → bool
-
Whether this finder skips nodes that are offstage.
no setteroverride
- tester → PatrolTester
-
PatrolTester
that this PatrolFinder wraps.final - text → String?
-
If the first widget found by this finder is a Text or RichText widget,
then this method returns its data.
no setter
- visible → bool
-
Returns true if this finder finds at least 1 visible widget.
no setter
Methods
-
$(
dynamic matching) → PatrolFinder - Shorthand for PatrolFinder.resolve.
-
apply(
Iterable< Element> candidates) → Iterable<Element> - Returns all the elements in the given list that match this finder's pattern.
-
at(
int index) → PatrolFinder -
Returns a variant of this finder that only matches the item at the
given index found by this finder.
override
-
containing(
dynamic matching) → PatrolFinder -
Returns PatrolFinder that this method was called on and which contains
matching
as a descendant. -
describeMatch(
Plurality plurality) → String -
Describes zero, one, or more candidates that match the requirements of a
finder.
override
-
enterText(
String text, {SettlePolicy? settlePolicy, Duration? visibleTimeout, Duration? settleTimeout}) → Future< void> - Waits until this finder finds at least 1 visible widget and then enters text into it.
-
evaluate(
) → FinderResult< Element> -
Searches a set of candidates for those that meet the requirements set by
this finder and returns the result of that search.
override
-
findInCandidates(
Iterable< Element> candidates) → Iterable<Element> -
Returns all the items in the given list that match this
finder's requirements.
override
-
hitTestable(
{Alignment at = Alignment.center}) → PatrolFinder -
Returns a variant of this finder that only matches elements reachable by
a hit test.
override
-
isVisibleAt(
{Alignment alignment = Alignment.center}) → bool -
Returns true if this finder finds at least 1 visible widget
at the given
alignment
. -
longPress(
{SettlePolicy? settlePolicy, Duration? visibleTimeout, Duration? settleTimeout}) → Future< void> - Waits until this finder finds at least 1 visible widget and then makes long press gesture on it.
-
matches(
Element candidate) → bool -
Returns true if the given element matches the pattern.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
precache(
) → bool - Attempts to evaluate the finder. Returns whether any elements in the tree matched the finder. If any did, then the result is cached and can be obtained from evaluate.
-
reset(
) → void -
Resets all state of this FinderBase.
override
-
runCached(
VoidCallback run) → void -
Runs the given callback using cached results.
override
-
scrollTo(
{Finder? view, double step = defaultScrollDelta, AxisDirection? scrollDirection, int maxScrolls = defaultScrollMaxIteration, Duration? settleBetweenScrollsTimeout, Duration? dragDuration, SettlePolicy? settlePolicy}) → Future< PatrolFinder> -
Shorthand for
PatrolTester.scrollUntilVisible
. -
tap(
{SettlePolicy? settlePolicy, Duration? visibleTimeout, Duration? settleTimeout}) → Future< void> - Waits until this finder finds at least 1 visible widget and then taps on it.
-
toString(
{bool describeSelf = false}) → String -
A string representation of this object.
override
-
tryEvaluate(
) → bool -
Searches a set of candidates for those that meet the requirements set by
this finder and returns whether the search found any matching candidates.
override
-
waitUntilExists(
{Duration? timeout}) → Future< PatrolFinder> - Waits until this finder finds at least one widget.
-
waitUntilVisible(
{Duration? timeout, bool enablePatrolLog = true, Alignment alignment = Alignment.center}) → Future< PatrolFinder> - Waits until this finder finds at least one visible widget.
-
which<
T extends Widget> (bool predicate(T widget)) → PatrolFinder -
Returns a finder matching widget of type
T
which also fulfillspredicate
. -
wrapWithPatrolLog<
T> ({required String action, String? value, required String color, required Future< T> function(), bool enablePatrolLog = true}) → Future<T> - Wraps a function with a log entry for the start and end of the function.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited