updateFeed method

Future<void> updateFeed({
  1. required String feedId,
  2. required Map<String, dynamic> data,
  3. bool partial = false,
  4. dynamic onSuccess(
    1. String
    )?,
  5. dynamic onError(
    1. dynamic
    )?,
})

Implementation

Future<void> updateFeed({
  required final String feedId,
  required final Map<String, dynamic> data,
  final bool partial = false,
  final Function(String)? onSuccess,
  final Function(dynamic)? onError,
}) async {
  try {
    final _data = PeamanCommonHelper.prepareDataToUpdate(
      data: data,
      partial: partial,
    );

    final _feedRef = PeamanReferenceHelper.feedsCol.doc(feedId);
    await _feedRef.update(_data);
    print('Success: Updating feed $feedId');
    onSuccess?.call(feedId);
  } catch (e) {
    print(e);
    print('Error!!!: Updating feed');
    onError?.call(e);
  }
}