Skip to content
pubscout

fling_units

3.0.8, released a year ago by gelbermungo.xyz

Dependency-free, type-safe Dart library for unit conversion.

WASM-ready
$ flutter pub add fling_units
Source repository

What it does

Abstracts measurement units into type-safe types that can be interpreted and converted between any valid units of the same dimension. Provides arithmetic operations, comparisons, standard SI prefixes, and derived units.

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

Use it when

  • You need type-safe unit conversions without risking domain logic errors
  • You want to decouple specific unit types from the rest of your code
  • You require calculations involving distance, mass, time, temperature, and other physical dimensions

Skip it when

  • You need external dependencies or databases to handle unit lookup configurations
  • You are dealing with domains completely unrelated to physical measurements or unit conversions

Strengths

  • Dependency-free and lightweight
  • Compile-time type safety preventing nonsensical unit operations
  • Comprehensive built-in support for SI prefixes, dimensions, and derived units

Weaknesses

  • Does not focus on performance micro-optimizations
  • Migration required when upgrading between major versions (such as 2.x to 3.x)

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0

none

var massOfTheMoon = (73.5).yocto.grams;
double massOfTheMoonInShortTons = massOfTheMoon.as(shortTons);

Alternatives

Packages that do the same job and could replace fling_units.

  • units_converter

    Lightweight Dart package for internationalizing and converting units of measurement.

  • dart_style

    Provides an API and CLI to format Dart source code automatically.

  • bcrypt

    Hashes passwords using the BCrypt algorithm.

  • physical

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