findSyncById method

  1. @override
Future<FindSyncResponse> findSyncById(
  1. SyncType type,
  2. String target
)

Returns a FindSyncResponse for sync with type and target

Upon success a Sync object is provided and error is set to null

In case of error a ResponseError is set and no Sync is provided

Implementation

@override
Future<FindSyncResponse> findSyncById(SyncType type, String target) {
  return catchSqlError<FindSyncResponse>(
      store.syncDao.findById(type, target).then((value) => value != null
          ? FindSyncResponse(sync: value)
          : FindSyncResponse(
              error: ResponseError.notFound(
                  message: 'Sync $target not found',
                  context: contextSync,
                  target: target))),
      (sqle) => FindSyncResponse(
          error:
              toResponseError(sqle, context: contextShader, target: target)),
      options);
}