watchById method

Stream<T?>? watchById(
  1. String id,
  2. String? userId
)

Watches a single entity by its ID, emitting the item on change or null if deleted. Returns null if the adapter does not support reactive queries.

Implementation

Stream<T?>? watchById(String id, String? userId) {
  _ensureInitialized();
  return localAdapter.watchById(id, userId: userId)?.asyncMap((item) {
    if (item == null) {
      return Future.value(null);
    }
    return _applyPostFetchTransforms(item);
  });
}