Skip to content
pubscout

physical

0.7.1, released 3 weeks ago by blok21.com

Library for dealing with physical quantities, units, and conversions.

WASM-ready
$ flutter pub add physical
Source repository

What it does

Provides classes and operations to represent physical dimensions, units, and quantities with zero dependencies. It supports unit conversions, arithmetic operations, temperature conversions, and optional compile-time type-safe quantities.

AI-written summary of version 0.7.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to handle physical quantities and unit conversions in Dart.
  • You want compile-time type safety for common dimensions like length, time, and speed.
  • You need zero dependencies and a lightweight library for calculations.

Skip it when

  • You are looking for UI widgets or form fields tailored for measurement inputs.

Strengths

  • Zero dependencies
  • Intuitive API using natural arithmetic operators
  • Optional compile-time type-safe quantities using extension types

Weaknesses

  • Limited to the dimensions, units, and features built into the core library or custom defined extensions

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0
import 'package:physical/physical.dart';
import 'package:physical/units/si.dart' as si;

final length   = qty(100, si.metre);       // 100 m
final time     = qty(20, si.second);       // 20 s
final speed    = length / time;            // 5 m/s
print(speed[si.metre.kilo / si.hour]); // 18.0 km/h

Alternatives

Packages that do the same job and could replace physical.

  • quantity

    Facilitates working with physical quantities, units, uncertainty, and arbitrary precision.

  • units_converter

    Lightweight Dart package for internationalizing and converting units of measurement.

  • byte_converter

    High‑performance byte and data‑rate conversion with BigInt precision and built‑in localization.

  • quantify

    Type-safe unit conversion and measurement library for Dart and Flutter.