RecognizerBag class

Owns the GestureRecognizers created while building spans, so they can be disposed together when the spans are discarded.

Recognizers referenced by a TextSpan are not disposed by the framework — whoever creates them must dispose them, a classic leak spot. DocumentSpanBuilder registers every recognizer it creates in the bag it is given; the widget owning the spans (see LineWidget) keeps the bag in its State, replaces it on rebuild, and disposes it on teardown.

Constructors

RecognizerBag()

Properties

count → int
Number of recognizers currently owned by this bag.
no setter
hashCode → int
The hash code for this object.
no setterinherited
isDisposed → bool
Whether dispose has been called.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() → void
Disposes every owned recognizer. The bag must not be used afterwards.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
register<T extends GestureRecognizer>(T recognizer) → T
Takes ownership of recognizer and returns it, for inline use: recognizer: bag.register(TapGestureRecognizer()..onTap = ...).
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited