fps_jank_flash_widget 1.1.0+3 copy "fps_jank_flash_widget: ^1.1.0+3" to clipboard
fps_jank_flash_widget: ^1.1.0+3 copied to clipboard

A flutter widget that flashes when flutter fails to render a frame in a certain timeframe

FPS Jank Flash widget #

A flutter widget that flashes when flutter fails to render a frame in a certain timeframe

lesnitsky.dev GitHub stars Twitter Follow

Installation #

flutter pub add fps_jank_flash_widget
flutter packages get

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()));
}

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(),
      ]
    );
  }
}

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());
}

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()));
}

License #

MIT

lesnitsky.dev GitHub stars Twitter Follow

21
likes
160
points
4
downloads

Publisher

verified publisherlesnitsky.dev

Weekly Downloads

A flutter widget that flashes when flutter fails to render a frame in a certain timeframe

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on fps_jank_flash_widget