quantity
5.0.0, released 6 months ago by an unverified publisher
Facilitates working with physical quantities, units, uncertainty, and arbitrary precision.
WASM-ready
What it does
Provides 75+ typed quantities, unit conversions, string parsing for measurements, and dimensional formula validation. It also supports relative standard uncertainty propagation and arbitrary precision calculations.
AI-written summary of version 5.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- Building science, engineering, or calculation-heavy applications that need strict unit discipline
- Parsing natural language strings into strongly typed physical quantities like speed or mass
- Validating symbolic formulas dimensionally before evaluation
Skip it when
- Your application does not perform physical calculations or deal with physical units
Strengths
- Automatic type inference during arithmetic operations
- Robust string parsing for units and compound measurements
- NIST CODATA constant integration and arbitrary precision support
Weaknesses
- Adds significant domain-specific API overhead if you only need basic numeric math
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 3
import 'package:quantity/quantity.dart';
final speed = Speed(metersPerSecond: 30);
final dist = Length(m: 1500);
final time = Time(s: 50);
final computed = dist / time;
print(computed);Alternatives
Packages that do the same job and could replace quantity.
Works with
Packages commonly used together with quantity: ones it builds on, ones built on it, and its own family.
- intlquantity depends on itA Dart library for internationalization and localization, providing message translation, plural/gender handling, and date/number formatting.
- loggingquantity depends on itProvides configurable logging with levels and stream listeners for Dart apps.
- decimalquantity depends on itArbitrary-precision decimal arithmetic for Dart
- countries_world_mapBuilt on quantityCustomizable world and country maps using CustomPainter for Flutter.