TickerSignal class
Ticker signal used to drive animations and can create animation controllers
void main() {
final ticker = TickerSignal(); // could be a global
final controller = ticker.toAnimationController(); // can be local or global
final curve = CurvedAnimation(parent: controller, curve: Curves.easeOut); // can be used outside of widget tree
final alpha = IntTween(begin: 0, end: 255).animate(curve);
...
final alphaSignal = alpha.toSignal(); // can be converted to a signal
}
- Inheritance
-
- Object
- ReadonlySignal<
Duration> - Signal<
Duration> - TickerSignal
- Implemented types
Constructors
- TickerSignal({Duration? initialDuration, String? debugLabel})
- Ticker signal used to drive animations and can create animation controllers
Properties
- autoDispose → bool
-
Throws and error if read after dispose and can be
disposed on last unsubscribe.
finalinherited
- debugLabel → String?
-
Debug label for Debug Mode
finalinherited
- disposed ↔ bool
-
Returns true if dispose has been called and will throw and
error on value read
getter/setter pairinherited
- equalityCheck ↔ bool Function(Duration a, Duration b)
-
Optional method to check if to values are the same
getter/setter pairinherited
- globalId → int
-
Global ID of the signal
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasTargets → bool
-
Check if there are any targets attached
no setterinherited
- initialValue → Duration
-
Value that the signal was created with
no setterinherited
- isInitialized → bool
-
Check if the signal is lazy and has not had a value set
no setterinherited
- previousValue → Duration?
-
Previous value that was set before the current
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
targets
→ Iterable<
SignalListenable> -
@internal for testing getter to track all the effects currently
effected in the signal
no setterinherited
- value ↔ Duration
-
Compute the current value
getter/setter pairinherited
- version → int
-
Version number is used to track changes and will increment for every set
no setterinherited
Methods
-
call(
) → Duration -
Return the value when invoked
inherited
-
createTicker(
TickerCallback onTick) → Ticker -
Creates a ticker with the given callback.
override
-
dispose(
) → void -
Dispose the signal
override
-
forceUpdate(
[Duration? val]) → void -
Force update a value
inherited
-
get(
) → Duration -
Get the current value
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onDispose(
void cleanup()) → EffectCleanup -
Add a cleanup function to be called when the signal is disposed
inherited
-
overrideWith(
Duration val) → Signal< Duration> -
Override the current signal with a new value as if it was created with it
inherited
-
peek(
) → Duration -
In the rare instance that you have an effect that should write to
another signal based on the previous value, but you don't want the
effect to be subscribed to that signal, you can read a signals's
previous value via
signal.peek()
.inherited -
readonly(
) → ReadonlySignal< Duration> -
Returns a readonly signal
inherited
-
set(
Duration val, {bool force = false}) → bool -
Update the current value.
inherited
-
subscribe(
void fn(Duration value)) → EffectCleanup -
Subscribe to value changes
inherited
-
toAnimationController(
{double? value, Duration? duration, Duration? reverseDuration, String? debugLabel, double lowerBound = 0.0, double upperBound = 1.0, AnimationBehavior animationBehavior = AnimationBehavior.normal}) → AnimationController - Create a new AnimationController
-
toJson(
) → dynamic -
Convert value to JSON
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited