measurements 0.0.5 copy "measurements: ^0.0.5" to clipboard
measurements: ^0.0.5 copied to clipboard

discontinued
outdated

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

badge

logo

pub test issues forks stars style license


Table of Contents #

About The Project #

Screenshot 1

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:

  • Length
  • Mass
  • Area

Built With #

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.");
  }
}

Roadmap #

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

License #

Distributed under the MIT License. See LICENSE for more information.

Contact #

BornIdeas - born.dev - info@born.dev

Project Link: https://github.com/born-ideas/measurements

Acknowledgements #

3
likes
0
pub points
0%
popularity

Publisher

verified publisherborn.dev

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

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

More

Packages that depend on measurements