Introducing StatsFl, an FPS monitor for Flutter — gskinner blog

gskinner team
Apr 14, 2020 · 2 min read

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!

Flutter Community

Articles and Stories from the Flutter Community

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store