international_system_of_units 1.0.0-dev.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 77

Pub Version

Easily convert unit from and to the international system of units and automatically get the localization for it.

How it work #

Conversions #

This package use extension on num to allow you to convert easily from one unit to another.

For example if you want to transform celsius to fahrenheit here is the code:


Localization #

We take care of the localization of the unit for you as an example on length this code will be localized:

isLocalizations.length.locale(12,; // 0.012 km

This is due to the fact that international system base unit for length is the meters.

What we support currently #

Converstions #


The base unit for area is square meter.

  • [x] to/from square centimeters
  • [x] to/from square kilometers
  • [x] to/from square miles
  • [x] to/from square yard
  • [x] to/from square foot
  • [x] to/from square inches
  • [x] to/from hectare
  • [x] to/from acre


The base unit for length is meter.

  • [x] to/from nanometers
  • [x] to/from micrometers
  • [x] to/from millimeters
  • [x] to/from centimeters
  • [x] to/from kilometers
  • [x] to/from inch
  • [x] to/from foot
  • [x] to/from yard
  • [x] to/from miles
  • [x] to/from nautical miles

Length Per Time (speed)

The base unit for length per time is meters per seconds.

  • [x] to/from knot
  • [x] to/from kilometers per hours
  • [x] to/from miles per hours

Length Per Volume

The base unit for length per volume is meters per liters.

  • [x] to/from kilometers per liters
  • [x] to/from miles per us gallons
  • [x] to/from miles per imperial gallons


The base unit for mass is kilograms.

  • [x] to/from tons
  • [x] to/from milligrams
  • [x] to/from micrograms
  • [x] to/from grams
  • [x] to/from imperial ton
  • [x] to/from us ton
  • [x] to/from stone
  • [x] to/from pound
  • [x] to/from ounce

Mass Per Length

The base unit for mass per length is kilograms per meters.

  • [x] to/from grams per meters
  • [x] to/from grams per miles
  • [x] to/from kilograms per kilometers
  • [x] to/from grams per kilometers


The base unit for pressure is pascal.

  • [x] to/from pound force per square inch
  • [x] to/from bar


The base unit for temperature is kelvin.

  • [x] to/from celsius
  • [x] to/from fahrenheit
  • [x] to/from rakine
  • [x] to/from romer


The base unit for time is seconds.

  • [x] to/from nanoseconds
  • [x] to/from microseconds
  • [x] to/from milliseconds
  • [x] to/from minutes
  • [x] to/from hours
  • [x] to/from days
  • [x] to/from weeks
  • [x] to/from months
  • [x] to/from years
  • [x] to/from decades
  • [x] to/from centuries


The base unit for volume is liters.

  • [x] to/from us liquid gallons
  • [x] to/from us liquid quart
  • [x] to/from us liquid pint
  • [x] to/from us legal cup
  • [x] to/from us fluid ounces
  • [x] to/from us teaspoon
  • [x] to/from us tablespoon
  • [x] to/from millimeters
  • [x] to/from imperial gallon
  • [x] to/from imperial quart
  • [x] to/from imperial pint
  • [x] to/from imperial cup
  • [x] to/from imperial fluid ounces
  • [x] to/from imperial teaspoon
  • [x] to/from imperial tablespoon
  • [x] to/from cubic meters
  • [x] to/from cubic foot
  • [x] t0/from cubic inch

Volume Per Length

The base unit for volume per length is liters per meters.

  • [x] to/from liters per kilometers
  • [x] to/from us gallons per miles
  • [x] to/from imperial gallons per miles
  • [x] to/from liters per 100 kilometers

Localizations #

Fuel economy

This is a localization helper it use different conversion under the hood for convinience.

The base unit is liters per meters

  • [x] liters per 100 kilometers
  • [x] miles per us gallons
  • [x] miles per imperial gallons

Length Per Time

The base unit is meters per seconds.

  • [x] kilometers per hours
  • [x] miles per hours
  • [x] knot
  • [x] meters per seconds

Length Per Volume

The base unit is meters per liters.

  • [x] meters per liters
  • [x] kilometers per liters
  • [x] miles per imperial gallons
  • [x] miles per us gallons


The base unit is meters.

  • [x] kilometers
  • [x] meters
  • [x] miles
  • [x] inch

Mass Per Length

The base unit is kilograms per meters.

  • [x] grams per meters
  • [x] grams per miles
  • [x] kilograms per kilometers
  • [x] grams per kilometers


The base unit is kilograms.

  • [x] micrograms
  • [x] milligrams
  • [x] grams
  • [x] kilograms
  • [x] tonnes
  • [x] imperial tons
  • [x] us tons
  • [x] ounces
  • [x] stone
  • [x] pounds


The base unit is pascals.

  • [x] pascals
  • [x] bar
  • [x] pound force per square inch


The base unit is kelvin.

  • [x] celsius
  • [x] fahrenheit
  • [x] kelvin
  • [x] rankine
  • [x] romer


The base unit is seconds.

  • [x] microseconds
  • [x] milliseconds
  • [x] seconds
  • [x] minutes
  • [x] hours
  • [x] days
  • [x] weeks
  • [x] months
  • [x] years
  • [x] decades
  • [x] centuries

Volume Per Length

The base unit is liters per meters

  • [x] imperial gallons per miles
  • [x] us gallons per miles
  • [x] liters per meters
  • [x] liters per kilometers
  • [x] liters per 100 kilometers


The base unit is liters

  • [x] cubic foot
  • [x] cubic feet
  • [x] cubic inch
  • [x] us/imperial cup
  • [x] us/imperial fluid ounce
  • [x] us/imperial quart
  • [x] us/imperial pint
  • [x] us/imperial tablespoon
  • [x] us/imperial teaspoon
  • [x] us/imperial liquid gallons
  • [x] milliliters
  • [x] liters

Supported language for localizations #

  • [x] en_US

Features and bugs #

For new conversion please fill new conversion.

If you find a bug.

Suggest new language.

Or something else here.

Contributing #

Please read our contibuting guides.

Support #

If you like or use this package please consider sponsoring me here.

1.0.0-dev.3 #

  • add french language

1.0.0-dev.2 #

  • add US/imperial for tons
  • fix default pressure unit for EU

1.0.0-dev.1 #

  • fix us/imperial legal cup localization
  • fix imperial fluid ounces
  • add missing localization in readme

1.0.0-dev #

  • Initial version


import 'package:international_system_of_units/international_system_of_units.dart';
import 'package:intl/intl.dart';
import 'package:intl/locale.dart';

void main(List<String> arguments) async {
  final language = 'en_US';
  //  ignore: unused_local_variable
  final sIi18n =
      await InternationalSystemLocalizations.load(Locale.parse(language));
  Intl.defaultLocale = language;

Use this package as a library

1. Depend on it

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

  international_system_of_units: ^1.0.0-dev.3

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:

import 'package:international_system_of_units/international_system_of_units.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jul 9, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14

Maintenance suggestions

Package is pre-release. (-5 points)

Pre-release versions should be used with caution; their API can change in breaking ways.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
international_system_of_units_locale ^1.0.0-dev.3 1.0.0-dev.3
intl ^0.16.1 0.16.1
Transitive dependencies
path 1.7.0
Dev dependencies
intl_translation ^0.17.10
pedantic ^1.8.0
test ^1.14.3