fps_jank_flash_widget

Last updated:

0 purchases

fps_jank_flash_widget Image
fps_jank_flash_widget Images
Add to Cart

Description:

fps jank flash widget

FPS Jank Flash widget #
A flutter widget that flashes when flutter fails to render a frame in a certain timeframe



Installation #
flutter pub add fps_jank_flash_widget
flutter packages get
copied to clipboard
Usage #
import 'package:fps_jank_flash_widget/fps_jank_flash_widget.dart';

void main() {
const frameBudget = Duration(milliseconds: 17); // 60 fps
FPSJankFlash.frameBudget = frameBudget;

runApp(FPSJankFlash.overlay(child: const MyApp()));
}
copied to clipboard
FPSJankFlash could be used directly:
import 'package:fps_jank_flash_widget/fps_jank_flash_widget.dart';

class SomeWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Stack(
children: [
Column(
children: [
/// ... your widgets,
],
),
const FPSJankFlash(),
]
);
}
}
copied to clipboard
You can also use a JankObserver:
import 'package:fps_jank_flash_widget/fps_jank_flash_widget.dart';

void main() {
JankObserver.addListener(() {
print('jank detected');
});

runApp(YourApp());
}
copied to clipboard
If you're testing the app on a higher refresh rate displays, override the frame duration budget:
import 'package:fps_jank_flash_widget/fps_jank_flash_widget.dart';


void main() {
const refreshRate = 120;
final budgetMs = 1000 ~/ refreshRate;
FPSJankFlash.frameBudget = Duration(milliseconds: budgetMs);

runApp(FPSJankFlash.overlay(child: const MyApp()));
}
copied to clipboard
License #
MIT

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.