A Dart package that helps you work with physical quantities and units seamlessly.

Created from templates made available by Stagehand under a BSD-style license.

Installation

See installation instructions here.

API Status

The API is highly experimental; large changes are planned. Do NOT use this package in production code unless you understand and accept the consequences of this.

Usage

import 'package:quantities/quantities.dart';

void main() {
  final height = 165(centi.meter);
  final weight = 53(kilo.gram);
  final bmi = weight / (height * height);
  print('${bmi.to(kilo.gram / squareMeter)} kg / m^2');
}

Credits

This package takes huge inspiration from purescript-quantites, especially in its internal design. Kudos to sharkdp!

Libraries

quantities