update<T> method

  1. @override
Future<Result<T>> update<T>(
  1. JsonObject dto
)
override

Implementation

@override
Future<Result<T>> update<T>(JsonObject<dynamic> dto) async {
  final id = dto.ids.id;
  assert(StringUtils.instance.isNotBlank(id));
  try {
    Logger.log(
      log: Log.i(_buildMessage(
          '${_collectionPath?.path}: Attempting to update object $id')),
    );

    final map = dto.toJson();
    await _collectionPath!.doc(id).update(map);

    return Result.success(obj: (dto as T));
  } catch (e, stacktrace) {
    return _getErrorLog(
      msg: e.toString(),
      stacktrace: stacktrace,
    );
  }
}