flutter开启高帧率

flutter 开启高帧率

yaml文件中添加依赖

1
flutter_displaymode: ^0.6.0

main.dart中添加

WidgetsFlutterBinding.ensureInitialized();

如下示例

1
2
3
4
void main() async {
WidgetsFlutterBinding.ensureInitialized();
runApp(const MyApp());
}

使用示例

1
2
3
final DisplayMode m = await FlutterDisplayMode.active;
print(m);
await FlutterDisplayMode.setHighRefreshRate();