Skip to content

Commit

Permalink
Add docs to SchedulerBinding (#136433)
Browse files Browse the repository at this point in the history
Add documentation that I went looking for and didn't find :-)
  • Loading branch information
tvolkert authored Oct 17, 2023
1 parent 0acd1f2 commit 4f6c2cc
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/flutter/lib/src/scheduler/binding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,11 @@ mixin SchedulerBinding on BindingBase {
/// Adds the given callback to the list of frame callbacks and ensures that a
/// frame is scheduled.
///
/// If this is called during the frame's animation phase (when transient frame
/// callbacks are still being invoked), a new frame will be scheduled, and
/// `callback` will be called in the newly scheduled frame, not in the current
/// frame.
///
/// If this is a one-off registration, ignore the `rescheduling` argument.
///
/// If this is a callback that will be re-registered each time it fires, then
Expand All @@ -573,6 +578,12 @@ mixin SchedulerBinding on BindingBase {
///
/// Callbacks registered with this method can be canceled using
/// [cancelFrameCallbackWithId].
///
/// See also:
///
/// * [WidgetsBinding.drawFrame], which explains the phases of each frame
/// for those apps that use Flutter widgets (and where transient frame
/// callbacks fit into those phases).
int scheduleFrameCallback(FrameCallback callback, { bool rescheduling = false }) {
scheduleFrame();
_nextFrameCallbackId += 1;
Expand Down Expand Up @@ -725,6 +736,12 @@ mixin SchedulerBinding on BindingBase {
///
/// Persistent frame callbacks cannot be unregistered. Once registered, they
/// are called for every frame for the lifetime of the application.
///
/// See also:
///
/// * [WidgetsBinding.drawFrame], which explains the phases of each frame
/// for those apps that use Flutter widgets (and where persistent frame
/// callbacks fit into those phases).
void addPersistentFrameCallback(FrameCallback callback) {
_persistentCallbacks.add(callback);
}
Expand Down Expand Up @@ -752,6 +769,9 @@ mixin SchedulerBinding on BindingBase {
///
/// * [scheduleFrameCallback], which registers a callback for the start of
/// the next frame.
/// * [WidgetsBinding.drawFrame], which explains the phases of each frame
/// for those apps that use Flutter widgets (and where post frame
/// callbacks fit into those phases).
void addPostFrameCallback(FrameCallback callback) {
_postFrameCallbacks.add(callback);
}
Expand Down

0 comments on commit 4f6c2cc

Please sign in to comment.