post method

  1. @override
Future<bool> post(
  1. ServiceOfJournal se
)
override

Add new ServiceOfJournal to Journal and call commitAll.

Implementation

@override
Future<bool> post(ServiceOfJournal se) async {
  final httpClient = httpInterface;
  final forSync = [se, ...servicesForSync]; // get list before ref changed
  try {
    await hiveRepository.add(se);
    // ignore: avoid_catching_errors, avoid_catches_without_on_clauses
  } catch (e) {
    showErrorNotification(tr().errorSave);
    // await commitAll(httpClient, forSync); // still call?

    return false;
  }
  await commitAll(httpClient, forSync);

  return true;
}