Skip to content
pubscout

fixnum

1.1.1, released 2 years ago by dart.dev

Provides 32‑ and 64‑bit signed fixed‑width integer types for Dart.

WASM-readyQuiet but busy
$ flutter pub add fixnum
Source repository

What it does

The package defines Int32 and Int64 classes that behave consistently on the Dart VM and when compiled to JavaScript. It includes parsing, conversion, and bit‑wise operations with overflow handling.

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

Use it when

  • You need precise 32‑ or 64‑bit integer arithmetic across platforms
  • You require deterministic overflow behavior for low‑level algorithms
  • You work with binary protocols or file formats that specify fixed‑width integers

Skip it when

  • Performance‑critical code can use native int if platform guarantees size
  • You only need arbitrary‑precision integers (use BigInt)

Strengths

  • Consistent behavior on VM and JS
  • Full set of parsing and conversion helpers
  • No external dependencies

Weaknesses

  • Adds a wrapper type instead of using native int
  • Limited to signed 32/64‑bit, no unsigned variants

Setup

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

void main() {
  Int64 a = Int64.parseInt('1234567890123456789');
  Int64 b = Int64(42);
  print((a + b).toString());
}

Alternatives

Packages that do the same job and could replace fixnum.

  • antlr4

    Dart runtime libraries for ANTLR 4 parser generator.

Works with

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