Skip to content

Commit 4f6c2cc

Browse files
authored
Add docs to SchedulerBinding (#136433)
Add documentation that I went looking for and didn't find :-)
1 parent 0acd1f2 commit 4f6c2cc

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

packages/flutter/lib/src/scheduler/binding.dart

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,11 @@ mixin SchedulerBinding on BindingBase {
559559
/// Adds the given callback to the list of frame callbacks and ensures that a
560560
/// frame is scheduled.
561561
///
562+
/// If this is called during the frame's animation phase (when transient frame
563+
/// callbacks are still being invoked), a new frame will be scheduled, and
564+
/// `callback` will be called in the newly scheduled frame, not in the current
565+
/// frame.
566+
///
562567
/// If this is a one-off registration, ignore the `rescheduling` argument.
563568
///
564569
/// If this is a callback that will be re-registered each time it fires, then
@@ -573,6 +578,12 @@ mixin SchedulerBinding on BindingBase {
573578
///
574579
/// Callbacks registered with this method can be canceled using
575580
/// [cancelFrameCallbackWithId].
581+
///
582+
/// See also:
583+
///
584+
/// * [WidgetsBinding.drawFrame], which explains the phases of each frame
585+
/// for those apps that use Flutter widgets (and where transient frame
586+
/// callbacks fit into those phases).
576587
int scheduleFrameCallback(FrameCallback callback, { bool rescheduling = false }) {
577588
scheduleFrame();
578589
_nextFrameCallbackId += 1;
@@ -725,6 +736,12 @@ mixin SchedulerBinding on BindingBase {
725736
///
726737
/// Persistent frame callbacks cannot be unregistered. Once registered, they
727738
/// are called for every frame for the lifetime of the application.
739+
///
740+
/// See also:
741+
///
742+
/// * [WidgetsBinding.drawFrame], which explains the phases of each frame
743+
/// for those apps that use Flutter widgets (and where persistent frame
744+
/// callbacks fit into those phases).
728745
void addPersistentFrameCallback(FrameCallback callback) {
729746
_persistentCallbacks.add(callback);
730747
}
@@ -752,6 +769,9 @@ mixin SchedulerBinding on BindingBase {
752769
///
753770
/// * [scheduleFrameCallback], which registers a callback for the start of
754771
/// the next frame.
772+
/// * [WidgetsBinding.drawFrame], which explains the phases of each frame
773+
/// for those apps that use Flutter widgets (and where post frame
774+
/// callbacks fit into those phases).
755775
void addPostFrameCallback(FrameCallback callback) {
756776
_postFrameCallbacks.add(callback);
757777
}

0 commit comments

Comments
 (0)