stats 0.0.1 copy "stats: ^0.0.1" to clipboard
stats: ^0.0.1 copied to clipboard

outdatedDart 1 only

Visual Dart Performance Monitor

stats.dart #

Dart Performance Monitor

This class provides a simple info box that will help you monitor your code performance.

  • FPS Frames rendered in the last second. The higher the number the better.
  • MS Milliseconds needed to render a frame. The lower the number the better.

Screenshots #

stats_js_fps.png stats_js_ms.png

Live Example #

example

Getting Started #

Create a Dart project and add a pubspec.yaml file to it

dependencies:
  stats:
    git: https://github.com/financeCoding/stats.dart.git

and run pub install to install stats (including its dependencies). Now add import

#import('package:stats/stats.dart');

Example #

#import('dart:html');
#import('package:stats/stats.dart');
void main() {
  Stats stats = new Stats();
  document.body.elements.add(stats.container);
  CanvasElement canvas = new CanvasElement();
  canvas.width = 512;
  canvas.height = 512;
  document.body.elements.add(canvas);
  CanvasRenderingContext2D context = canvas.getContext('2d');
  context.fillStyle = 'rgba(127,0,255,0.05)';
  
  draw(time) {
    context.clearRect(0, 0, 512, 512);

    stats.begin();

    for (var i = 0; i < 2000; i++) {

      var x = Math.cos(time + i * 0.01) * 196 + 256;
      var y = Math.sin(time + i * 0.01234) * 196 + 256;

      context.beginPath();
      context.arc(x, y, 10, 0, Math.PI * 2, true);
      context.fill();

    }

    stats.end();
    window.requestAnimationFrame(draw);
  }
  
  window.requestAnimationFrame(draw);
}

Thanks #

mrdoob for the stats.js code.

30
likes
0
pub points
87%
popularity

Publisher

verified publisherj832.com

Visual Dart Performance Monitor

Homepage

License

unknown (LICENSE)

More

Packages that depend on stats