unit_convert 0.1.3 copy "unit_convert: ^0.1.3" to clipboard
unit_convert: ^0.1.3 copied to clipboard

A Dart unit converter to convert between numerous units easily.

example/example.md

Usage #

Conversions #

You can use the convert function to convert between most units:

import 'package:unit_convert/unit_convert.dart';

//                     (from)    (to)
double result = convert(celsius, fahrenheit, 100);

or using the to method on each unit:

double result = celsius.to(fahrenheit, 100);

or shorthand using function invocation:

double result = celsius(fahrenheit, 100);

or using from for more clarity:

double result = from(celsius).to(fahrenheit, 100);

The most commonly used units are already imported by default. If you need to convert between less commonly used units, please use the enum of the unit category:

double result = convert(LengthUnit.astronomicalUnit, LengthUnit.lightYear, 100000);
double result = TimeUnit.leapYear.to(TimeUnit.quindecinnal, 10);
double result = from(EnergyUnit.kilocalorie).to(EnergyUnit.wattHour, 1000);
5
likes
100
pub points
51%
popularity

Publisher

unverified uploader

A Dart unit converter to convert between numerous units easily.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

meta

More

Packages that depend on unit_convert