objectid
4.0.3, released 8 months ago by klyta.it
Blazing fast, cross-platform ObjectId implementation for Dart and Flutter.
WASM-ready
What it does
Provides a BSON-compliant ObjectId implementation for Dart, allowing creation from timestamps, hex strings, raw byte arrays, and custom values. It supports caching for properties like hex strings and timestamps, and provides utility methods like JSON serialization and validation.
AI-written summary of version 4.0.3, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need MongoDB-compatible ObjectIds in your Dart or Flutter application.
- You want unique identifiers containing generation timestamp data.
Skip it when
- You only need standard RFC-compliant UUIDs (use the uuid package instead).
Strengths
- Extremely fast performance across all platforms including Web, Node.js, and VM.
- Fully conforms to the BSON ObjectId specification.
- Includes built-in JSON serialization methods (fromJson/toJson).
Weaknesses
- Limited scope restricted entirely to ObjectId generation and parsing.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
final id = ObjectId();
print(id.hexString); // => 5f52c805df41c9df948e6135Alternatives
Packages that do the same job and could replace objectid.
Works with
Packages commonly used together with objectid: ones it builds on, ones built on it, and its own family.