Skip to content
pubscout

fixed

6.3.0, released 4 weeks ago by onepub.dev

Fixed decimal numbers with a fixed scale, stored as BigInts, supporting math, formatting and parsing.

WASM-ready
$ flutter pub add fixed
Source repository

What it does

Provides a Fixed type that stores decimal numbers with a selectable number of decimal places using BigInts for precision. It offers arithmetic operators, comparison, formatting (including locale-aware) and parsing with error handling.

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

Use it when

  • Need precise decimal arithmetic for currencies or financial data
  • Require locale-aware formatting and parsing of decimal numbers
  • Want to avoid floating-point inaccuracies in calculations

Skip it when

  • Working with arbitrary-precision decimals beyond a fixed scale
  • Needing binary floating-point math for performance-critical code

Strengths

  • High precision via BigInt storage
  • Built-in formatting and parsing with locale support
  • Full set of arithmetic operators and comparison
  • Consistent hash codes across different scales

Weaknesses

  • Limited to a fixed number of decimal places
  • No support for arbitrary-precision beyond the set scale
  • Requires Dart SDK 3.9.0 or higher

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
3
import 'package:fixed/fixed.dart';

void main() {
  final t1 = Fixed.fromNum(1, decimalDigits: 2); // 1.00
  final t2 = Fixed.fromNum(1, decimalDigits: 3); // 1.000
  final add = t1 + Fixed.ten;
  final multiply = t1 * t2;
  print(add); // 11.00
  print(multiply); // 1.00000
}

Alternatives

Packages that do the same job and could replace fixed.

Works with

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