objectToJson function
Attempts to call toJson() on an object.
Implementation
Map<String, dynamic>? objectToJson(dynamic object) {
try {
Map<String, dynamic> json = object.toJson();
return json;
} on NoSuchMethodError catch (e) {
NyLogger.debug(e.toString());
NyLogger.error(
'[NyStorage.store] ${object.runtimeType.toString()} model needs to implement the toJson() method.',
);
}
return null;
}