flutter_fps 0.1.1
flutter_fps: ^0.1.1 copied to clipboard

Flutter Android iOS Linux macOS web Windows

A Flutter library to catch fps.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_fps/flutter_fps.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Fps Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Fps Demo'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  void initState() {
    super.initState();
    Fps.instance.start();
    Fps.instance.addFpsCallback((fpsInfo) {
      print(fpsInfo);
    });
  }

  @override
  void dispose() {
    Fps.instance.stop();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: GridView.count(
        crossAxisCount: 2,
        mainAxisSpacing: 8,
        crossAxisSpacing: 8,
        padding: EdgeInsets.all(8),
        children: List.generate(100, (index) {
          return Stack(
            children: <Widget>[
              Image.network(
                'https://source.unsplash.com/random/200x200?index=$index',
                fit: BoxFit.cover,
              ),
              Text('$index'),
            ],
          );
        }),
      ),
    );
  }
}
1
likes
90
pub points
45%
popularity

A Flutter library to catch fps.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

chenenyux@gmail.com

License

Apache 2.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_fps