statsd 0.1.2

  • Installing
  • Versions
  • 40

StatsD client for Dart

Build Status Coverage Status Pub package License

A StatsD client library implemented in Dart.


Use git dependency in your pubspec.yaml:

  statsd: "^0.1.1"

And then import it as usual:

import 'package:statsd/statsd.dart';


Basic example:

import 'dart:io';
import 'dart:async';
import 'package:statsd/statsd.dart';

Future main() async {
  var connection = await StatsdConnection.connect(
  var client = new StatsdClient(connection, prefix: 'myapp');
  // Sending counters:
  await client.count('metric1'); // increment `myapp.metric1` by 1
  await client.count('metric1', -1); // decrement `myapp.metric1` by 1
  await client.count('metric1', 5, 0.1); // increment `myapp.metric1` by 5 with 0.1 sample rate

  // Sending timings:
  var stopwatch = new Stopwatch();
  // client will use value of stopwatch.elapsedMilliseconds
  await client.time('response-time', stopwatch);

  // Sending gauges:
  await client.gauge('metric2', 428); // sets gauge value to 428
  await client.gaugeDelta('metric2', 3); // increments value by 3
  await client.gaugeDelta('metric2', -10); // decrements value by 10

  // Sending sets:
  await client.set('uniques', 345);

  // Sending multiple metrics at once:
  var batch = client.batch();
    ..time('response-time', stopwatch)
    ..count('total-requests', 3)
    ..set('metric1', 56);
  await batch.send();

  // Make sure to close the connection when done:

Current limitations:

  • Only UDP connections are supported at this moment.



Change Log

All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.



  • added logger (name 'statsd') as well as some logging for UDP connection.
  • added possibility to set prefix for metric names in StatsdClient.
  • fixed bug in UDP connection when it was binding to the same port as Statsd server.


  • initial version

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  statsd: "^0.1.2"

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

      import 'package:statsd/statsd.dart';
Version Uploaded Documentation Archive
0.1.2 Feb 19, 2016 Go to the documentation of statsd 0.1.2 Download statsd 0.1.2 archive
0.1.1 Jan 8, 2016 Go to the documentation of statsd 0.1.1 Download statsd 0.1.1 archive
0.1.0 Jan 8, 2016 Go to the documentation of statsd 0.1.0 Download statsd 0.1.0 archive


We analyzed this package on May 22, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.54.0
  • pana: 0.11.1


Describes how popular the package is relative to other packages. [more]
21 / 100
Code health derived from static analysis. [more]
99 / 100
Reflects how tidy and up-to-date the package is. [more]
0 / 100
Overall score:
Weighted score of the above. [more]
Learn more about scoring.


Detected platforms: Flutter, other

Primary library: package:statsd/statsd.dart with components: io.


  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use statsd.dart.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 1 hint.

    Strong-mode analysis of lib/src/connection.dart gave the following hint:

    line: 36 col: 46
    'ANY_IP_V4' is deprecated and shouldn't be used.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.12.0 <2.0.0
logging ^0.11.2 0.11.3+1
Dev dependencies
dart_coveralls ^0.4.0
mockito ^0.11.0
test ^0.12.6+1