Skip to content
pubscout

decimal

3.2.6, released 4 months ago by an unverified publisher

Arbitrary-precision decimal arithmetic for Dart

WASM-ready
$ flutter pub add decimal
Source repository

What it does

Provides a Decimal type that avoids floating‑point precision loss. It supports arithmetic, comparison, and formatting via intl.

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

Use it when

  • Need exact decimal math (e.g., finance, scientific calculations)
  • Want to format decimals with intl NumberFormat
  • Require consistent results across platforms

Skip it when

  • Only need simple double math
  • Performance critical and can tolerate floating‑point errors

Strengths

  • Precise decimal arithmetic
  • Built‑in formatting helpers
  • Works on all Dart platforms

Weaknesses

  • Adds a dependency on intl for formatting
  • No built‑in JSON serialization
  • Not a code‑generation library

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
2

Add dependency in pubspec and import 'package:decimal/decimal.dart';

import 'package:decimal/decimal.dart';

void main() {
  var a = Decimal.parse('0.2');
  var b = Decimal.parse('0.1');
  print(a + b); // 0.3
}

Alternatives

Packages that do the same job and could replace decimal.

Works with

Packages commonly used together with decimal: ones it builds on, ones built on it, and its own family.