quantity 0.2.0+1

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 69

quantity

Facilitates working with physical quantities.

This is a work in progress; this package's API may change significantly.
Some parts are currently unfinished, untested and/or undocumented. Use at your own risk.

Quick start

// Import the core library
import 'package:quantity/quantity_si.dart';

// Construct an Angle in radians
var ang = new Angle(rad: 1.1);

// Construct an Angle in degrees
var ang2 = new Angle(deg: 270);

// Find the difference
var diff = ang2 - ang;

// Display the result in degrees
print(diff.valueInUnits(Angle.degrees);

Key Features

  • Typed quantities (such as Length, Mass and Temperature) that are easy to construct and use in calculations.
  • Encourages use of standard units by isolating non-standard units in an extension library.
  • Support for relative standard uncertainty in quantity values and calculations.
  • Allows use of arbitrary precision values (as well as complex and imaginary values).
  • Provides access to the latest official constant values published by NIST.
  • Integration with Dart's existing Duration and DateTime classes.
  • Extensive set of quantity types and standard and non-standard units.
  • Support for untyped quantities having unusual dimensions with the MiscQuantity class.
  • Models quantity ranges, including special support for angle ranges and time spans.
  • Includes a mutable quantity with streams.
  • Metric prefixes for any unit.

0.2.0+1

  • Dart 2 support.
  • Stricter typing.
  • Addressed many (but not all) analyzer items.

0.1.5

  • Upgraded dependencies: intl 0.14 and quiver 0.23

0.1.4

  • Added isScalar and isScalarSI to Dimensions and Quantity.
  • Extended use of type hints in dimensions for more efficient and accurate type determination during operations.
  • Generalized special handling of scalar quantities.

0.1.3+1

  • Fixed CHANGELOG.md formatting.

0.1.3

  • Added operator == and hashCode to quantity range classes.
  • Added toTypedQuantity to MiscQuantity.
  • Changed googol constant to arbitrary precision.
  • Renamed private _dimensions constructor to _internal in quantities.

0.1.2

  • Precise isInteger and _limitPrecision fixes.
  • hashCode testing for quantity objects (esp. Scalar)

0.1.1

  • Temperature, TemperatureInterval tests, tweaks, bug fixes.

0.1.0

  • Initial version.

Use this package as a library

1. Depend on it

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


dependencies:
  quantity: ^0.2.0+1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:


import 'package:quantity/quantity.dart';
  
Version Uploaded Documentation Archive
0.2.0+1 Aug 6, 2018 Go to the documentation of quantity 0.2.0+1 Download quantity 0.2.0+1 archive
0.2.0 Aug 6, 2018 Go to the documentation of quantity 0.2.0 Download quantity 0.2.0 archive
0.1.4 Oct 23, 2015 Go to the documentation of quantity 0.1.4 Download quantity 0.1.4 archive
0.1.3+1 Oct 23, 2015 Go to the documentation of quantity 0.1.3+1 Download quantity 0.1.3+1 archive
0.1.3 Oct 23, 2015 Go to the documentation of quantity 0.1.3 Download quantity 0.1.3 archive
0.1.2 Oct 5, 2015 Go to the documentation of quantity 0.1.2 Download quantity 0.1.2 archive
0.1.1 Oct 4, 2015 Go to the documentation of quantity 0.1.1 Download quantity 0.1.1 archive
0.1.0 Oct 3, 2015 Go to the documentation of quantity 0.1.0 Download quantity 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
51
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
69
Learn more about scoring.

We analyzed this package on Dec 5, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:quantity/quantity.dart.

Health suggestions

Fix lib/src/number/real.dart. (-0.50 points)

Analysis of lib/src/number/real.dart reported 1 hint:

line 131 col 20: The value of the local variable 'aOverc2d2' isn't used.

Fix lib/src/si/units.dart. (-0.50 points)

Analysis of lib/src/si/units.dart reported 1 hint:

line 619 col 8: The method '_canDisplayString' isn't used.

Format lib/domain/astronomical.dart.

Run dartfmt to format lib/domain/astronomical.dart.

Fix additional 135 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/domain/electromagnetic.dart (Run dartfmt to format lib/domain/electromagnetic.dart.)
  • lib/domain/thermodynamic.dart (Run dartfmt to format lib/domain/thermodynamic.dart.)
  • lib/domain/universal.dart (Run dartfmt to format lib/domain/universal.dart.)
  • lib/number.dart (Run dartfmt to format lib/number.dart.)
  • lib/quantity_si.dart (Run dartfmt to format lib/quantity_si.dart.)
  • lib/range/angle_range.dart (Run dartfmt to format lib/range/angle_range.dart.)
  • lib/range/quantity_range.dart (Run dartfmt to format lib/range/quantity_range.dart.)
  • lib/range/time_period.dart (Run dartfmt to format lib/range/time_period.dart.)
  • lib/src/ext/acceleration_ext.dart (Run dartfmt to format lib/src/ext/acceleration_ext.dart.)
  • lib/src/ext/amount_of_substance_ext.dart (Run dartfmt to format lib/src/ext/amount_of_substance_ext.dart.)
  • lib/src/ext/angle_ext.dart (Run dartfmt to format lib/src/ext/angle_ext.dart.)
  • lib/src/ext/angular_momentum_ext.dart (Run dartfmt to format lib/src/ext/angular_momentum_ext.dart.)
  • lib/src/ext/angular_speed_ext.dart (Run dartfmt to format lib/src/ext/angular_speed_ext.dart.)
  • lib/src/ext/area_ext.dart (Run dartfmt to format lib/src/ext/area_ext.dart.)
  • lib/src/ext/capacitance_ext.dart (Run dartfmt to format lib/src/ext/capacitance_ext.dart.)
  • lib/src/ext/charge_ext.dart (Run dartfmt to format lib/src/ext/charge_ext.dart.)
  • lib/src/ext/conductance_ext.dart (Run dartfmt to format lib/src/ext/conductance_ext.dart.)
  • lib/src/ext/current_ext.dart (Run dartfmt to format lib/src/ext/current_ext.dart.)
  • lib/src/ext/electric_potential_difference_ext.dart (Run dartfmt to format lib/src/ext/electric_potential_difference_ext.dart.)
  • lib/src/ext/energy_ext.dart (Run dartfmt to format lib/src/ext/energy_ext.dart.)
  • lib/src/ext/energy_flux_ext.dart (Run dartfmt to format lib/src/ext/energy_flux_ext.dart.)
  • lib/src/ext/entropy_ext.dart (Run dartfmt to format lib/src/ext/entropy_ext.dart.)
  • lib/src/ext/force_ext.dart (Run dartfmt to format lib/src/ext/force_ext.dart.)
  • lib/src/ext/illuminance_ext.dart (Run dartfmt to format lib/src/ext/illuminance_ext.dart.)
  • lib/src/ext/inductance_ext.dart (Run dartfmt to format lib/src/ext/inductance_ext.dart.)
  • lib/src/ext/kinematic_viscosity_ext.dart (Run dartfmt to format lib/src/ext/kinematic_viscosity_ext.dart.)
  • lib/src/ext/length_ext.dart (Run dartfmt to format lib/src/ext/length_ext.dart.)
  • lib/src/ext/magnetic_flux_density_ext.dart (Run dartfmt to format lib/src/ext/magnetic_flux_density_ext.dart.)
  • lib/src/ext/magnetic_flux_ext.dart (Run dartfmt to format lib/src/ext/magnetic_flux_ext.dart.)
  • lib/src/ext/mass_density_ext.dart (Run dartfmt to format lib/src/ext/mass_density_ext.dart.)
  • lib/src/ext/mass_ext.dart (Run dartfmt to format lib/src/ext/mass_ext.dart.)
  • lib/src/ext/mutable/mutable_quantity.dart (Run dartfmt to format lib/src/ext/mutable/mutable_quantity.dart.)
  • lib/src/ext/permeability_ext.dart (Run dartfmt to format lib/src/ext/permeability_ext.dart.)
  • lib/src/ext/permittivity_ext.dart (Run dartfmt to format lib/src/ext/permittivity_ext.dart.)
  • lib/src/ext/power_ext.dart (Run dartfmt to format lib/src/ext/power_ext.dart.)
  • lib/src/ext/pressure_ext.dart (Run dartfmt to format lib/src/ext/pressure_ext.dart.)
  • lib/src/ext/resistance_ext.dart (Run dartfmt to format lib/src/ext/resistance_ext.dart.)
  • lib/src/ext/scalar_ext.dart (Run dartfmt to format lib/src/ext/scalar_ext.dart.)
  • lib/src/ext/solid_angle_ext.dart (Run dartfmt to format lib/src/ext/solid_angle_ext.dart.)
  • lib/src/ext/specific_energy_ext.dart (Run dartfmt to format lib/src/ext/specific_energy_ext.dart.)
  • lib/src/ext/spectral_irradiance_ext.dart (Run dartfmt to format lib/src/ext/spectral_irradiance_ext.dart.)
  • lib/src/ext/speed_ext.dart (Run dartfmt to format lib/src/ext/speed_ext.dart.)
  • lib/src/ext/temperature_ext.dart (Run dartfmt to format lib/src/ext/temperature_ext.dart.)
  • lib/src/ext/time_ext.dart (Run dartfmt to format lib/src/ext/time_ext.dart.)
  • lib/src/ext/time_instant_ext.dart (Run dartfmt to format lib/src/ext/time_instant_ext.dart.)
  • lib/src/ext/volume_ext.dart (Run dartfmt to format lib/src/ext/volume_ext.dart.)
  • lib/src/ext/volume_flow_rate_ext.dart (Run dartfmt to format lib/src/ext/volume_flow_rate_ext.dart.)
  • lib/src/number/complex.dart (Run dartfmt to format lib/src/number/complex.dart.)
  • lib/src/number/double.dart (Run dartfmt to format lib/src/number/double.dart.)
  • lib/src/number/fraction.dart (Run dartfmt to format lib/src/number/fraction.dart.)
  • lib/src/number/imaginary.dart (Run dartfmt to format lib/src/number/imaginary.dart.)
  • lib/src/number/integer.dart (Run dartfmt to format lib/src/number/integer.dart.)
  • lib/src/number/number.dart (Run dartfmt to format lib/src/number/number.dart.)
  • lib/src/number/precise.dart (Run dartfmt to format lib/src/number/precise.dart.)
  • lib/src/si/dimensions.dart (Run dartfmt to format lib/src/si/dimensions.dart.)
  • lib/src/si/exponential_units.dart (Run dartfmt to format lib/src/si/exponential_units.dart.)
  • lib/src/si/immutable_quantity_exception.dart (Run dartfmt to format lib/src/si/immutable_quantity_exception.dart.)
  • lib/src/si/misc_quantity.dart (Run dartfmt to format lib/src/si/misc_quantity.dart.)
  • lib/src/si/number_format_si.dart (Run dartfmt to format lib/src/si/number_format_si.dart.)
  • lib/src/si/quantity.dart (Run dartfmt to format lib/src/si/quantity.dart.)
  • lib/src/si/types/absorbed_dose.dart (Run dartfmt to format lib/src/si/types/absorbed_dose.dart.)
  • lib/src/si/types/absorbed_dose_rate.dart (Run dartfmt to format lib/src/si/types/absorbed_dose_rate.dart.)
  • lib/src/si/types/acceleration.dart (Run dartfmt to format lib/src/si/types/acceleration.dart.)
  • lib/src/si/types/activity.dart (Run dartfmt to format lib/src/si/types/activity.dart.)
  • lib/src/si/types/amount_of_substance.dart (Run dartfmt to format lib/src/si/types/amount_of_substance.dart.)
  • lib/src/si/types/angle.dart (Run dartfmt to format lib/src/si/types/angle.dart.)
  • lib/src/si/types/angular_acceleration.dart (Run dartfmt to format lib/src/si/types/angular_acceleration.dart.)
  • lib/src/si/types/angular_momentum.dart (Run dartfmt to format lib/src/si/types/angular_momentum.dart.)
  • lib/src/si/types/angular_speed.dart (Run dartfmt to format lib/src/si/types/angular_speed.dart.)
  • lib/src/si/types/area.dart (Run dartfmt to format lib/src/si/types/area.dart.)
  • lib/src/si/types/capacitance.dart (Run dartfmt to format lib/src/si/types/capacitance.dart.)
  • lib/src/si/types/catalytic_activity.dart (Run dartfmt to format lib/src/si/types/catalytic_activity.dart.)
  • lib/src/si/types/charge.dart (Run dartfmt to format lib/src/si/types/charge.dart.)
  • lib/src/si/types/charge_density.dart (Run dartfmt to format lib/src/si/types/charge_density.dart.)
  • lib/src/si/types/concentration.dart (Run dartfmt to format lib/src/si/types/concentration.dart.)
  • lib/src/si/types/conductance.dart (Run dartfmt to format lib/src/si/types/conductance.dart.)
  • lib/src/si/types/currency.dart (Run dartfmt to format lib/src/si/types/currency.dart.)
  • lib/src/si/types/current.dart (Run dartfmt to format lib/src/si/types/current.dart.)
  • lib/src/si/types/current_density.dart (Run dartfmt to format lib/src/si/types/current_density.dart.)
  • lib/src/si/types/dose_equivalent.dart (Run dartfmt to format lib/src/si/types/dose_equivalent.dart.)
  • lib/src/si/types/dynamic_viscosity.dart (Run dartfmt to format lib/src/si/types/dynamic_viscosity.dart.)
  • lib/src/si/types/electric_field_strength.dart (Run dartfmt to format lib/src/si/types/electric_field_strength.dart.)
  • lib/src/si/types/electric_flux_density.dart (Run dartfmt to format lib/src/si/types/electric_flux_density.dart.)
  • lib/src/si/types/electric_potential_difference.dart (Run dartfmt to format lib/src/si/types/electric_potential_difference.dart.)
  • lib/src/si/types/energy.dart (Run dartfmt to format lib/src/si/types/energy.dart.)
  • lib/src/si/types/energy_density.dart (Run dartfmt to format lib/src/si/types/energy_density.dart.)
  • lib/src/si/types/energy_flux.dart (Run dartfmt to format lib/src/si/types/energy_flux.dart.)
  • lib/src/si/types/entropy.dart (Run dartfmt to format lib/src/si/types/entropy.dart.)
  • lib/src/si/types/exposure.dart (Run dartfmt to format lib/src/si/types/exposure.dart.)
  • lib/src/si/types/force.dart (Run dartfmt to format lib/src/si/types/force.dart.)
  • lib/src/si/types/frequency.dart (Run dartfmt to format lib/src/si/types/frequency.dart.)
  • lib/src/si/types/heat_flux_density.dart (Run dartfmt to format lib/src/si/types/heat_flux_density.dart.)
  • lib/src/si/types/illuminance.dart (Run dartfmt to format lib/src/si/types/illuminance.dart.)
  • lib/src/si/types/inductance.dart (Run dartfmt to format lib/src/si/types/inductance.dart.)
  • lib/src/si/types/information.dart (Run dartfmt to format lib/src/si/types/information.dart.)
  • lib/src/si/types/information_rate.dart (Run dartfmt to format lib/src/si/types/information_rate.dart.)
  • lib/src/si/types/kinematic_viscosity.dart (Run dartfmt to format lib/src/si/types/kinematic_viscosity.dart.)
  • lib/src/si/types/length.dart (Run dartfmt to format lib/src/si/types/length.dart.)
  • lib/src/si/types/level.dart (Run dartfmt to format lib/src/si/types/level.dart.)
  • lib/src/si/types/luminance.dart (Run dartfmt to format lib/src/si/types/luminance.dart.)
  • lib/src/si/types/luminous_flux.dart (Run dartfmt to format lib/src/si/types/luminous_flux.dart.)
  • lib/src/si/types/luminous_intensity.dart (Run dartfmt to format lib/src/si/types/luminous_intensity.dart.)
  • lib/src/si/types/magnetic_field_strength.dart (Run dartfmt to format lib/src/si/types/magnetic_field_strength.dart.)
  • lib/src/si/types/magnetic_flux.dart (Run dartfmt to format lib/src/si/types/magnetic_flux.dart.)
  • lib/src/si/types/magnetic_flux_density.dart (Run dartfmt to format lib/src/si/types/magnetic_flux_density.dart.)
  • lib/src/si/types/mass.dart (Run dartfmt to format lib/src/si/types/mass.dart.)
  • lib/src/si/types/mass_density.dart (Run dartfmt to format lib/src/si/types/mass_density.dart.)
  • lib/src/si/types/mass_flow_rate.dart (Run dartfmt to format lib/src/si/types/mass_flow_rate.dart.)
  • lib/src/si/types/mass_flux_density.dart (Run dartfmt to format lib/src/si/types/mass_flux_density.dart.)
  • lib/src/si/types/molar_energy.dart (Run dartfmt to format lib/src/si/types/molar_energy.dart.)
  • lib/src/si/types/molar_entropy.dart (Run dartfmt to format lib/src/si/types/molar_entropy.dart.)
  • lib/src/si/types/permeability.dart (Run dartfmt to format lib/src/si/types/permeability.dart.)
  • lib/src/si/types/permittivity.dart (Run dartfmt to format lib/src/si/types/permittivity.dart.)
  • lib/src/si/types/power.dart (Run dartfmt to format lib/src/si/types/power.dart.)
  • lib/src/si/types/pressure.dart (Run dartfmt to format lib/src/si/types/pressure.dart.)
  • lib/src/si/types/radiance.dart (Run dartfmt to format lib/src/si/types/radiance.dart.)
  • lib/src/si/types/radiant_intensity.dart (Run dartfmt to format lib/src/si/types/radiant_intensity.dart.)
  • lib/src/si/types/resistance.dart (Run dartfmt to format lib/src/si/types/resistance.dart.)
  • lib/src/si/types/scalar.dart (Run dartfmt to format lib/src/si/types/scalar.dart.)
  • lib/src/si/types/solid_angle.dart (Run dartfmt to format lib/src/si/types/solid_angle.dart.)
  • lib/src/si/types/specific_energy.dart (Run dartfmt to format lib/src/si/types/specific_energy.dart.)
  • lib/src/si/types/specific_heat_capacity.dart (Run dartfmt to format lib/src/si/types/specific_heat_capacity.dart.)
  • lib/src/si/types/specific_volume.dart (Run dartfmt to format lib/src/si/types/specific_volume.dart.)
  • lib/src/si/types/spectral_irradiance.dart (Run dartfmt to format lib/src/si/types/spectral_irradiance.dart.)
  • lib/src/si/types/speed.dart (Run dartfmt to format lib/src/si/types/speed.dart.)
  • lib/src/si/types/surface_tension.dart (Run dartfmt to format lib/src/si/types/surface_tension.dart.)
  • lib/src/si/types/temperature.dart (Run dartfmt to format lib/src/si/types/temperature.dart.)
  • lib/src/si/types/temperature_interval.dart (Run dartfmt to format lib/src/si/types/temperature_interval.dart.)
  • lib/src/si/types/thermal_conductivity.dart (Run dartfmt to format lib/src/si/types/thermal_conductivity.dart.)
  • lib/src/si/types/time.dart (Run dartfmt to format lib/src/si/types/time.dart.)
  • lib/src/si/types/time_instant.dart (Run dartfmt to format lib/src/si/types/time_instant.dart.)
  • lib/src/si/types/torque.dart (Run dartfmt to format lib/src/si/types/torque.dart.)
  • lib/src/si/types/volume.dart (Run dartfmt to format lib/src/si/types/volume.dart.)
  • lib/src/si/types/volume_flow_rate.dart (Run dartfmt to format lib/src/si/types/volume_flow_rate.dart.)
  • lib/src/si/types/wave_number.dart (Run dartfmt to format lib/src/si/types/wave_number.dart.)

Maintenance suggestions

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use quantity.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.24.3 <3.0.0
dart2_constant ^1.0.1+dart1 1.0.2+dart2
intl ^0.15.0 0.15.7
logging ^0.11.3 0.11.3+2
Transitive dependencies
path 1.6.2
Dev dependencies
test >=0.12.30