add<T> method
Implementation
@override
Future<Result<String>> add<T>(JsonObject dto) async {
try {
Logger.log(
log: Log.i(_buildMessage(
'Attempting to add ${dto.runtimeType.toString()} object')),
);
final map = dto.toJson();
DocumentReference result = await _collectionPath!.add(map);
return StringUtils.instance.isNotBlank(result.id)
? Result.success(obj: result.id)
: _getErrorLog(
stacktrace: StackTrace.current,
msg: 'Received an empty result when adding an object',
);
} catch (e, stacktrace) {
return _getErrorLog(
msg: e.toString(),
stacktrace: stacktrace,
);
}
}