-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Previously, developers have to override onReportTimings to listen for FrameTiming.
That can potentially break older onReportTimings listeners if they forget to call
the old listener in their new callback.
Now, we'll provide the ability of adding multiple callbacks similar to that of addPostFrameCallback.
For history, we previously tried a BroadcastStream approach and abandoned it: #39778
We propose to add a broadcast stream of
FrameTiming, and deprecateonReportTimings(https://github.com/flutter/> engine/pull/11041).Then, we'll remove
onReportTimingsentirely after a few weeks of transition time.This change would make it safer and more convenient to listen for
FrameTiming.To migrate your code, simply add your previous callback to
frameTimings.listeninstead of directly assign it to >onReportTimings, and change the input parameter from a list to a singleFrameTiming. See the following snippet > for an example:WidgetsBinding.instance.window.onReportTimings = (List<FrameTiming> timings) {==>
WidgetsBinding.instance.window.frameTimings.listen((FrameTiming frameTiming) {See also #38861 where we remove our own usage of
onReportTimings. Once it's > merged,TestWindow.onReportTimingswill be a dummy method that no longer providesFrameTimings.