quantity 5.0.0
quantity: ^5.0.0 copied to clipboard
Facilitates working with physical quantities such as angles, lengths, masses, temperatures and many others. Supports uncertainty and arbitrary precision.
The example folder contains some example code to help you get started with the quantity package.
Angles Example #
// Import the quantity library.
import 'package:quantity/quantity.dart';
// Construct an Angle using fluent extension.
final ang = 1.1.radians;
print('Angle1 (deg): ${ang.inDegrees}');
// Construct an Angle in degrees.
final ang2 = 270.degrees;
print('Angle2 (deg): $ang2');
// Find the difference.
final diff = ang2 - ang as Angle;
// Display the result in degrees.
print('Difference (deg): ${diff.inDegrees}');
// Display the result in radians.
print('Difference (rad): ${diff.inRadians}');
// Find the sum.
final sum = ang2 + ang as Angle;
// Display the result in degrees.
print('Sum (deg): ${sum.inDegrees}');
// Display the result in radians.
print('Sum (rad): ${sum.inRadians}');