unities_helper

Creator: coderz1093

Last updated:

0 purchases

unities_helper Image
unities_helper Images
Add to Cart

Description:

unities helper

A library to help Dart developers to convert unities and a few other things.



















English | Português
Usage #
A simple usage example:
import 'package:unities_helper/unities_helper.dart';

main() {
/// Convert 25°C into Fahrenheit
final temperature = convert<Temperature>(
Temperature.celcius, // from
Temperature.fahrenheit, // to
25, // value
);
print(temperature);
}
copied to clipboard
A more detailed example can be found on the example folder
Supported conversions #

Area
Color spaces
Data transfer rate
Digital storage
Energy
Frequency
Fuel Economy
Length
Mass
Plane angle
Pressure
Speed
Temperature
Time
Volume

Area #










Square Kilometre (km²)
Square metre (m²)
Square mile (mi²)


Square yard
Square foot
Square inch (in²)


Hectare
Acre




main() {
final area = convertArea(
Area.squareMetre, // from
Area.squareKilometre, // to
10000000, // value
);
print(area); // 10
}
copied to clipboard
Color spaces #











HEX
HSV
HSLA
RGB



main() {
final hex = RGBColor(red: 255, green: 255, blue: 255).toHex;
print(hex);
}
copied to clipboard
Data Transfer Rate #



bit
kilo
mega
giga
tera





kibibit
mebibit
gibibit
tebibit


bit
kilobit
megabit
gigabit
terabit



kilobyte
megabyte
gigabyte
terabyte



main() {
final rate = convertDataTransferRate(
DataTransferRate.gigabyte, // from
DataTransferRate.megabyte, // to
1, // value
);
print(rate); // 1000
}
copied to clipboard
Digital storage #



bit
kilo
mega
giga
tera
peta




bit
kilobit
megabit
gigabit
terabit
petabit


byte
kibibit
mebibit
gibibit
tebibit
pebibit



kilobyte
megabyte
gigabyte
terabyte
petabyte



kibibyte
mebibyte
gibibyte
tebibyte
pebibyte



main() {
final storage = convertDigitalStorage(
DigitalStorage.gigabyte, // from
DigitalStorage.megabyte, // to
1, // value
);
print(storage); // 1000
}
copied to clipboard
Energy #










Joule
Kilojoule
Gram calorie


Kilocalorie
Watt-hour
Kilowatt-hour


electron-volt
Termal Unit
Foot-pound



main() {
final energy = convertEnergy(
Energy.kilocalorie, // from
Energy.gramCalorie, // to
1, // value
);
print(energy); // 1000
}
copied to clipboard
Frequency #











Hertz (Hz)
Kilohertz (kHz)
Megahertz (mHz)
Gigahertz (gHz)



main() {
final frequency = convertEnergy(
Frequency.megahertz, // from
Frequency.hertz, // to
1, // value
);
print(frequency); // 1000000
}
copied to clipboard
Fuel Economy #









Kilometer per litre
Liter per 100 kilometres


Mile per US Gallon
Mile per Imperial Gallon



main() {
final fuel = convertFuelEconomy(
FuelEconomy.kilometerPerLitre, // from
FuelEconomy.milePerUsGallon, // to
1, // value
);
print(fuel); // 2,35215
}
copied to clipboard
Length #











Nanometer
Micrometer
Millimeter
Centimeter


Meter
Kilometer
Inch
Mile


Yard
Feet
Nautical Mile




main() {
final length = convertLength(
Length.centimeter, // from
Length.meter, // to
100, // value
);
print(length); // 1
}
copied to clipboard
Mass #











Tonne
Gram
Kilogram
Milligram


Microgram
Stone
Pound
Ounce



main() {
final mass = convertMass(
Mass.kilogram, // from
Mass.gram, // to
1, // value
);
print(mass); // 1000
}
copied to clipboard
Plane Angle° #










Degree
Gradian
Milliradian


Radian
Minute of arc
Second of arc



main() {
final angle = convertPlaneAngle(
PlaneAngle.degree, // from
PlaneAngle.minuteOfArc, // to
1, // value
);
print(angle); // 60
}
copied to clipboard
Pressure #











Bar
Pascal
Torr
Standart Atmosphere


Pounc-force \in²






\in² = per square-inch
main() {
final pressure = convertPressure(
Pressure.bar, // from
Pressure.pascal, // to
1, // value
);
print(pressure); // 100000
}
copied to clipboard
Speed #












Miles/h
Foot/s
Metre/s
Kilemetre/h
Knot



main() {
final speed = convertSpeed(
Speed.metrePerSecond, // from
Speed.kilometrePerHour, // to
1, // value
);
print(speed); // 3.6
}
copied to clipboard
Temperature #










Celcius
Fahrenheit
Kelvin



main() {
final temperature = convertTemperature(
Temperature.celcius, // from
Temperature.fahrenheit, // to
0, // value
);
print(temperature); // 32
}
copied to clipboard
Time #












Nanosecond
microsend
millisecond
second
minute


hour
day
week
month
year


decade
centure
millenium





main() {
final time = convertTime(
Time.minute, // from
Time.second, // to
1, // value
);
print(temperature); // 60
}
copied to clipboard
Volume #










Liquid Gallon
Liquid Quart
Liquid Pint


Cup
Fluid Ounce
Tablespoon


Teaspoon
Cubic Metre
Litre


Millilitre
Gallon
Cubic Foot


Cubic Inch





main() {
final volume = convertVolume(
Volume.litre, // from
Volume.millilitre, // to
1, // value
);
print(volume); // 1000
}
copied to clipboard
Using extension methods #
Instead of using convert + unit name, you can use num.as + unit name. For example, if I want to convert mass, I can do it with two ways:
Using convert method #
main() {
final mass = convertMass(Mass.kilogram, Mass.gram, 10);
print(mass);
}
copied to clipboard
Using extension methods #
main() {
final mass = 10.asMass(Mass.kilogram).toGram;
print(mass);
}
copied to clipboard
Both will print the same results. You can use extension methods with the following conversion types:

✔️ Area
❌ Color
✔️ Data Transfer Rate
✔️ Digital Storage
✔️ Energy
✔️ Frequency
✔️ Fuel Economy
✔️ Length
✔️ Mass
✔️ Plane Angle
✔️ Pressure
✔️ Speed
✔️ Temperature
✔️ Time
✔️ Volume

Features and bugs #
Please file feature requests and bugs at the issue tracker.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.