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.
5.0.0 #
- Dart 3+ Modernization: Applied
sealed,base, andfinalmodifiers toNumber,Quantity, andDimensionsclasses. Refactored map parsing and type determination using modern pattern matching and switch expressions. - Fluent DX & Unit Shortcuts: Added extension getters on
numandNumber(e.g.,5.meters,75.tps) and unit shortcuts (inKilometers,inTps,inCelsius). - Registry Decoupling & Tree-Shaking: Decoupled the physical quantity registry by registering subclasses dynamically, allowing for clean tree-shaking. Added a lightweight core entrypoint
lib/quantity_core.dart. - JSON Serialization: Added full
toJson()andfromJson()support toQuantity,Number, andDimensionshierarchies. - Decimal Interoperability: Integrated the
decimalpackage directly, introducingvalueSIAsDecimal,toDecimal(), andfromDecimal(Decimal)to allow high-precision decimal operations. - NIST Constants Sync: Added an automated script
bin/update_nist_constants.dartto synchronize physical constants and uncertainties with the official NIST CODATA table. - AI Readiness & Natural Language Processing:
- Added
Quantity.parse(String text)for parsing natural language physical measurements (e.g.,'120 km/h','9.8 m/s^2'). - Added
Quantity.checkDimensionalConsistencyto symbolically check math formula consistency (e.g.,s = u * t + 0.5 * a * t^2). - Added
Dimensions.describereturning human-readable dimensions (e.g.'Length^1 / Time^2'). - Exposed structured JSON schemas (
Quantity.jsonSchema) for structured LLM function calling.
- Added
- Computational & Digital Layout Quantities:
- Introduced
TokenandTokenRateclasses to support modeling, parsing, and arithmetic for NLP/LLM context tracking and throughput metrics. - Introduced
Pixel,Resolution(pixels per length), andPixelDensity(pixels per area) classes to support spatial layout scaling, screen resolution calibration (PPI/DPI/DPCM), and graphics calculations with type-safe arithmetic operators.
- Introduced
- Synonym Quantity Types: Added compile-time typedef aliases and dynamic runtime name registry mapping for 19 physical quantity synonyms across 12 distinct classes (e.g.
Irradiance/EnergyFluxDensity/PowerFluxDensitysynonymizingHeatFluxDensity,StresssynonymizingPressure,WorksynonymizingEnergy, etc.). - Domain Collections: Added six domain library collections under
lib/domain/to group quantity types, units, and constants commonly encountered in specific fields:radiometry,atomic_nuclear,computing,chemistry,acoustics, andfluid_dynamics. Added corresponding unit tests for each domain. - Algebraic Property Verification: Established property-based testing for
Dimensionsalgebra. - Test Coverage Boost: Significantly expanded unit test coverage across the package. Wrote comprehensive tests for previously untested parts including the
Fractionnumber representation class, trig functions and constants inangle_ext, fluent utility extensions onnumandNumber, and verified variable mappings across all 40+ extension libraries. Further expanded coverage by testing astronomical time scale conversions, range math, exception string serialization, logarithmic level operations, and dynamically generated Unit constructors/derivatives across all 75+ physical quantity classes. Raised overall repository code coverage to 90.7% (surpassing the targets of 70% and 85%).
4.0.0 #
- Breaking changes:
- Changed some compound unit constructor names to be more descriptive.
- Made
Units.singularproperty non-nullable. - Number
==operators now take anObjectargument instead ofdynamic,
- Updated the minimum
intldependency to0.19.0. - Added unit tests for all compound unit constructors.
- Fixed numerous bugs in compound unit constructor logic.
- Accounted for lower case
ein number formatting/grouping. - Removed logging of quantity type resolution failure from
inversemethod. - Updated formatting; addressed pana suggestions.
3.0.2 #
- Update lint dependency to
^3.0.0.
3.0.1 #
- Fixed bugs in Precise class.
3.0.0 #
- Requires >= Dart SDK 3.0.
2.0.1 #
- Support for intl 0.18.
2.0.0 #
- Support for Dart 2.12, null safety.
1.0.0 #
- Requires >= Dart SDK 2.3.
- Increased testing.
- Number formatting; quantity text output.
- The latest official constants.
- TimeInstant extensions.
- MutableQuantity.
0.3.0 #
- Relaxed
intlpackage version dependency to>=0.15.0 <1.0.0.
0.2.0+1 #
- Dart 2 support.
- Stricter typing.
- Addressed many (but not all) analyzer items.
0.1.5 #
- Upgraded dependencies:
intl 0.14andquiver 0.23.
0.1.4 #
- Added
isScalarandisScalarSItoDimensionsandQuantity. - 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.mdformatting.
0.1.3 #
- Added
operator ==andhashCodeto quantity range classes. - Added
toTypedQuantitytoMiscQuantity. - Changed
googolconstant to arbitrary precision. - Renamed private
_dimensionsconstructor to_internalin quantities.
0.1.2 #
PreciseisIntegerand_limitPrecisionfixes.hashCodetesting for quantity objects (esp.Scalar)
0.1.1 #
Temperature,TemperatureIntervaltests, tweaks, bug fixes.
0.1.0 #
- Initial version.