未验证 提交 629930e8 编写于 作者: L liyuqian 提交者: GitHub

Prefer SchedulerBinding.addTimingsCallback (#13728)

This doc update solves our TODO in https://github.com/flutter/flutter/pull/43676/files#diff-6a35a9a692c9af7473ba1a0a74c979c8R223
上级 ddceed5f
......@@ -69,7 +69,12 @@ enum FramePhase {
/// Time-related performance metrics of a frame.
///
/// See [Window.onReportTimings] for how to get this.
/// If you're using the whole Flutter framework, please use
/// [SchedulerBinding.addTimingsCallback] to get this. It's preferred over using
/// [Window.onReportTimings] directly because
/// [SchedulerBinding.addTimingsCallback] allows multiple callbacks. If
/// [SchedulerBinding] is unavailable, then see [Window.onReportTimings] for how
/// to get this.
///
/// The metrics in debug mode (`flutter run` without any flags) may be very
/// different from those in profile and release modes due to the debug overhead.
......@@ -933,6 +938,10 @@ class Window {
/// A callback that is invoked to report the [FrameTiming] of recently
/// rasterized frames.
///
/// It's prefered to use [SchedulerBinding.addTimingsCallback] than to use
/// [Window.onReportTimings] directly because
/// [SchedulerBinding.addTimingsCallback] allows multiple callbacks.
///
/// This can be used to see if the application has missed frames (through
/// [FrameTiming.buildDuration] and [FrameTiming.rasterDuration]), or high
/// latencies (through [FrameTiming.totalSpan]).
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册