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 metres... (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
- Builds on me_sure_meant, providing support for common
Length
. - Common SI and Imperial 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 yottametre and quectometre needs
- Extension Methods to make defining a quantity as easy as writing
(32.inches() + 24.yards() + 3.miles() - 2.kilometres()).toUnit(Metre.decimetre)
First Class (No, really, they're dedicated classes!) support for measurements in Length:
- Imperial:
Inches
,Hands
,Feet
,Yards
,Chains
,Furlongs
,Miles
,Leagues
- SI:
Metre
Getting started
Dependency: me_sure_meant library. It should work in any Dart 3+ runtime environment.
Usage
Check out the demos in example/lenny_example.dart
Here's a teaser
/// 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);
Additional information
This package is Free and Open Source Software by Visionary Software Solutions. Alternative licensing is available, on a sliding scale case-by-case basis. (Contact nico at visionary.software)
Libraries
- fundamental_length
- length_conversion_strategy
- lenny
- Visionary Software Solutions Measurement API: fluent, joyful measurement. Lenny: Provides useful Length units.