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
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.
Works with
Packages commonly used together with fixnum: ones it builds on, ones built on it, and its own family.
- uuidBuilt on fixnumGenerates and parses RFC‑4122/9562 UUIDs (v1‑v8) for Dart.
- built_valueBuilt on fixnumImmutable value types with builders, enum classes and JSON serialization for Dart.
- protobufBuilt on fixnumProvides runtime support for Dart protocol buffer messages generated by protoc_plugin.
- grpcBuilt on fixnumDart implementation of gRPC, a high performance universal RPC framework.
- zxing2Built on fixnumPure Dart library for encoding and decoding QR codes.
- protoc_pluginBuilt on fixnumGenerates Dart source files from Protocol Buffer (.proto) definitions using the protoc compiler.
- livekit_clientBuilt on fixnumFlutter Client SDK for LiveKit to build real-time video, audio, and data features.
- dlibphonenumberBuilt on fixnumParse, format, validate and extract international phone numbers in pure Dart.