# measurements 0.0.6 measurements: ^0.0.6 copied to clipboard

A dart package providing basic classes for working with measurements such as Length and Mass.

Working with different units of measurements can be a pain. This project provides a Dart Library with basic classes for working with various measurement units. So far the supported measurements include:

• [x] Length
• [x] Mass
• [x] Area

## Getting Started #

### Prerequisites #

This package can only be used by other dart projects. If this is your first dart project, see the following pages to help you get started:

### Installation #

Add `measurements` as a dependency in your pubspec.yaml file.

## Usage #

Conversions:

``````import 'package:measurements/measurements.dart';

void main(List<String> arguments) async {
Length heightOfEverest = Length.fromMetres(8848.0);
print("Height of Everest (in metres): \${heightOfEverest.inMetres}.");
print("Height of Everest (in kilometres): \${heightOfEverest.inKilometres}.");
print("Height of Everest (in yards): \${heightOfEverest.inYards}.");
print("Height of Everest (in miles): \${heightOfEverest.inMiles}.");
}
``````

Calculations:

``````import 'package:measurements/measurements.dart';

void main(List<String> arguments) async {
Area a = Area.fromAcres(87.0);
Area b = Area.fromAcres(43.0);
print("a + b is \${(a + b).inAcres} acres.");
print("a - b is \${(a - b).inAcres} acres.");
print("a * 4 is \${(a * 4).inAcres} acres.");
print("a / 4 is \${(a / 4).inAcres} acres.");
}
``````

Comparisons:

``````import 'package:measurements/measurements.dart';

void main(List<String> arguments) async {
Mass elephantWeight = Mass.fromKilograms(5400);
Mass zebraWeight = Mass.fromKilograms(380);
if (elephantWeight == zebraWeight) {
print("An elephant and a Zebra have the same weight.");
} else if (zebraWeight < elephantWeight) {
Mass difference = elephantWeight - zebraWeight;
print("An elephant is \${difference.inPounds} pounds heavier than a zebra.");
} else {
Mass difference = zebraWeight - elephantWeight;
print("A Zebra is \${difference.inPounds} pounds heavier than an elephant.");
}
}
``````

We are hoping to provide the following measurements in the near future:

• [ ] DataTransferRate
• [ ] DigitalStorage
• [ ] Energy
• [ ] Frequency
• [ ] Pressure
• [ ] Speed
• [ ] Temperature
• [ ] Volume

See the open issues for a list of other proposed features (and known issues).

## Contributing #

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

## Contact #

BornIdeas - born.dev - info@born.dev

## Acknowledgements #

3
likes
100
pub points
27%
popularity

### Publisher

A dart package providing basic classes for working with measurements such as Length and Mass.