useSingleTickerState function
Provides a hook to create a single ticker state for animations.
This hook returns a TickerProvider that can be used with AnimationController and other animation-related classes.
Example:
final tickerProvider = useSingleTickerState();
final animationController = AnimationController(
vsync: tickerProvider,
duration: const Duration(seconds: 1),
);
Implementation
TickerProvider useSingleTickerState() {
final context = useContext();
final ticker = _SingleTickerState(context);
onActivated(ticker.activate);
onBeforeUnmount(ticker.dispose);
onDebugFillProperties(ticker.debugFillProperties);
return ticker;
}