Skip to content
pubscout

stats

3.0.0, released a year ago by kevmoo.com

Calculate common statistical values for a set of numbers.

WASM-ready
$ flutter pub add stats
Source repository

What it does

Calculates statistical metrics like min, max, mean, count, and sum of squares over a List or Stream of numbers. Also supports calculating confidence intervals.

AI-written summary of version 3.0.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to compute basic statistics like mean, min, and max from a collection or stream of numbers.
  • You want to calculate confidence intervals based on numerical data.

Skip it when

  • You need advanced statistical features like median, which were removed in version 3.0.0.

Strengths

  • Supports calculating stats on the fly from a Stream using a transformer.
  • Simple API with minimal dependencies.

Weaknesses

  • Does not support median calculations as of version 3.0.0.

Setup

Kind
Pure Dart
Effort
Low
Code generation
Yes (build_runner)
Direct dependencies
1
import 'dart:convert';
import 'package:stats/stats.dart';

void main() {
  final input = [1, 2, 3, 4, 5, 6, 7, 8];
  final stats = Stats.fromData(input);
  final confidence = ConfidenceInterval.calculate(
    stats,
    ConfidenceLevel.percent95,
  );
  print(confidence);
}

Alternatives

Packages that do the same job and could replace stats.

  • g_json

    Convenient JSON access and manipulation with optional getters and setters

  • moving_average

    Calculate simple, weighted, and exponential moving averages for lists of numbers or objects.

  • checkdigit

    A set of check digit algorithms used for error detection on identification numbers.

Works with

Packages commonly used together with stats: ones it builds on, ones built on it, and its own family.