Introducing StatsFl, an FPS monitor for Flutter — gskinner blog

gskinner team
Flutter Community
Published in
2 min readApr 14, 2020

As we begin pushing Flutter to more platforms such as Desktop and Web, it is becoming increasingly important to quickly and easily measure performance of your application. While the built-in performance monitor gets the job done, it leaves a lot to be desired in terms of readability.

To help ease this problem, we have created StatsFl:
https://pub.dev/packages/statsfl

To use, just wrap your root view in the StatsFl widget:

StatsFl(child: MyApp());

With that simple change you’ll get a discrete FPS history chart in the top-left of your application!

For the most part the default options should be all you need but just in case, we’ve made it fairly configurable. The image below shows StatsFl in 3 configurations. As you can see, alignment, width and height are all adjustable. You can even toggle off showText for a minimalist mode (bottom).

Additionally, you can adjust the sampleTime and totalTime to be as long as you need. In this example, we’re calculating every .5 seconds, over a 15 second period, for a total of 30 samples.

return StatsFl( 
sampleTime: .5, //Interval between fps calculations, in seconds.
totalTime: 15, //Total length of timeline, in seconds.
child: MyApp()
);

If you like the package, please toss a thumbs up to help increase the popularity!

--

--