# Visionary Software Solutions Measurement API: fluent, joyful measurement...FOR SCIENCE!

Meant to fight the odious practice witnessed in many code bases of using only integers/doubles for measurements/units and "knowing contextually" that a number corresponds to a measurement in kilograms... (which may be converted in the body of a method).

The goal of this API is to enable code written about measurements to be clear, expressive, and straightforward to reason about and understand by baking behaviors (such as well known conversion factors and arithmetic) directly into types.

## Features

• Rich Measurement API enabling definition of `Mass`, `Energy`, `Temperature`, `Time`, `Volume`, and `LuminousIntensity`.
• Common SI, Imperial, and US Customary units.
• Fluent definition, unit conversion, and addition/subtraction.
• Uncertainty in measurement with propagation through calculations.
• Framework pieces to easily extend and evolve, replacing implementations or adding new features
• Full SI prefix support for all your yotta and quectom needs
• Extension Methods to make defining a quantity as easy as writing `(20.kilograms() - 32.pounds()).toUnit(Gram.milligram)`

...but this package is a building block for functionality now! Cool stuff below is linked with their new homes!

## First Class (No, really, they're dedicated classes!) support for measurements in:

1. Energy ==> energizr
• SI : `Joules` and `KiloCalories`
2. Length ==> lenny
• Imperial: `Inches`, `Hands`, `Feet`, `Yards`, `Chains`, `Furlongs`, `Miles`, `Leagues`
• SI: `Metre`
3. Mass ==> massive
• SI: Kilogram (as `Grams`)
• Imperial: `Ounces`, `Pounds`, `Stones`, `Tons` (Long)
4. Temperature ==> temper
• SI: `Kelvins`, `DegreesCelsius`
• Imperial: `DegreesFahrenheit`
5. Time ==> god_of_the_mind
• SI: `Seconds`, `Minutes`, `Hours`, `Days`
6. Volume (Liquid) ==> pump_up_the_volume
• SI: `Litres`
• Imperial: `ImperialFluidOunces`, `Gills`, `ImperialPints`, `ImperialQuarts`, `ImperialGallons`
• US Customary: `Teaspoons`, `Tablespoons`, `USFluidOunces`, `Shots`, `Cups`, `USPints`, `USQuarts`, `USGallons`

Also note that the package is built using Best Practice software engineering principles. The code is meant to be as SOLID as possible (thanks Uncle Bob!) with Stable Abstractions that work interchangeably (don't like `Crude` or `BasicUncertainty` `Measurement`s? Roll your own!). DECORATOR for SI `MetricPrefix` was an obviously nice win I'm surprised I haven't seen done more. The library has test coverage and planned seams for modularization once the basics are proven out.

## Getting started

No prerequisites. This package is "platform"/foundational. It should work in any Dart 3+ runtime environment.

## Usage

Check out the demos in example/me_sure_meant_example.dart

# Here's a teaser from what you'll find in lenny

`````` /// and the big payoff is that you can do complicated things simply
final mess = (32.inches() + 24.yards() + 3.miles() - 2.kilometres())
.toUnit(Metre.decimetre);

/// Do you have any idea what this is? I didn't!
print(mess);
``````