You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When working with Flutter there are a lot of common callbacks and values that are used like AppLifecyleState, Frame callbacks and accessibility settings.
signals_flutter could provide the common signals to be used in the app:
voidmain() {
final widgetsBinding =WidgetsBinding.instance;
final schedulerBinding =SchedulerBinding.instance;
final onFrame =signal<Duration>(Duration.zero);
final onScheduleFrame =signal<Duration>(Duration.zero);
final timings =listSignal<FrameTiming>([]);
final appLifecycle =signal<AppLifecycleState>(AppLifecycleState.resumed);
final accessibilityFocus = widgetsBinding.accessibilityFocus.toSignal();
schedulerBinding
..addPersistentFrameCallback(onFrame.set)
..addTimingsCallback(timings.set)
..scheduleFrameCallback(onScheduleFrame.set, rescheduling:false);
widgetsBinding
.addObserver(AppLifecycleListener(onStateChange: appLifecycle.set));
effect(() {
print('on new frame: $onFrame');
});
effect(() {
print('on schedule frame: $onScheduleFrame');
});
effect(() {
print('on timings: $timings');
});
effect(() {
print('accessibilityFocus: $accessibilityFocus');
});
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
When working with Flutter there are a lot of common callbacks and values that are used like AppLifecyleState, Frame callbacks and accessibility settings.
signals_flutter could provide the common signals to be used in the app:
Beta Was this translation helpful? Give feedback.
All reactions