unit 1.0.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 69

Unit #

Three types: Angle, HourAngle, and Time, useful in astronomy applications.

This is a Dart port of the original Go library created by Sonia Keys and hosted at https://github.com/soniakeys/unit.

These types are all angle-like types. The Time type is at least angle-related. It has conversions to and from the other types and has a function to wrap a Time value to the fractional part of a day.

Motivation #

This package supports https://github.com/shawnlauzon/meeus, which implements a large colection of astronomy algorithms.

Install #

See installation instructions on pub.dev

License #


1.0.3 20 May 2020 #

Change return type of math operations from double to num.

1.0.2 15 May 2020 #

Fix bug in Time.operator== that causes Time == comparison to do >= instead of ==.

1.0.1 #

Add longer description in package.yaml.

1.0.0 #


import 'dart:math' as math;

import 'package:unit/unit.dart';

void main() {
  var halfCircle = Angle(math.pi);
  var rightAngle = Angle.fromDeg(90);

  print('This is 270 degrees: ${(halfCircle + rightAngle).deg}');

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  unit: ^1.0.3

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:unit/unit.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jul 2, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
Dev dependencies
pedantic ^1.8.0
test ^1.6.0