IDConverter class

A custom JsonConverter for converting between ObjectId and String.

This converter facilitates the serialization and deserialization of MongoDB's ObjectId objects to and from JSON strings. It provides a conversion between the ObjectId type used in MongoDB and the String type commonly used in JSON data.

This converter is useful when working with MongoDB in Dart applications, particularly when using the json_annotation package for JSON serialization and deserialization.

Constructors

IDConverter()
Creates a new instance of IDConverter.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

fromJson(ObjectId? json) String
Converts a JSON value to a String representation of ObjectId.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson(String object) → ObjectId?
Converts a String representation of ObjectId to an ObjectId.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited