-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Add a dart:ui API to set the preferred refresh rate.
Currently On iOS, if the device is a pro-motion device, Flutter engine sets the refresh rate to 120fps. This drains unnecessary batteries when the app is idle or performing a low-impact animations (a small spinner widget etc).
This issue propose below changes to the current behavior.
- Lower the refresh rate to 60fps as it satisfies most non-high-impact animations.
- Add a dart:ui API to allow Apps to bump the refresh rate to 80 or 120 as they see fit.
- Call this API in certain default Flutter widgets to take advantage of high refresh rates during high-impact animations (scrolling, page transition etc)
Above iOS 15, the preferred refresh rate is set as a range: (minimum, preferred, max)
Below iOS 15, one can only set a single value as preferred refresh rate.
The dart:UI API should be something like:
setPreferredRefreshRate(RefreshRateRange rate)
The object RefreshRateRange should contain 3 values, minimum, preferred, max. Below iOS 15, only preferred is used.
Another option is to have the default stay in 120fps, App can choose to lower the refresh rate (using the provided dart:ui API) to 60 if they need to preserve battery.