submit method

FutureOr<bool> submit(
  1. FutureOr<bool> submission(), {
  2. String? submissionReason,
  3. Iterable<IObservable<BaseEvent>>? submissionChanges,
  4. String? successReason,
  5. Iterable<IObservable<BaseEvent>>? successChanges,
  6. Iterable<IObservable<BaseEvent>>? errorChanges,
})

Implementation

FutureOr<bool> submit(
  FutureOr<bool> Function() submission, {
  String? submissionReason,
  Iterable<IObservable<BaseEvent>>? submissionChanges,
  String? successReason,
  Iterable<IObservable<BaseEvent>>? successChanges,
  Iterable<IObservable<BaseEvent>>? errorChanges,
}) async {
  try {
    submitting(reason: submissionReason, changes: submissionChanges);

    final result = await submission();

    submissionSuccess(reason: successReason, changes: successChanges);

    return result;
  } on Exception catch (e) {
    submissionError(e, changes: errorChanges);
    return false;
  }
}