watchOne method

DataState<T?> watchOne(
  1. Object model,
  2. {bool? remote,
  3. Map<String, dynamic>? params,
  4. Map<String, String>? headers,
  5. AlsoWatch<T>? alsoWatch,
  6. String? finder,
  7. DataRequestLabel? label}

Watches a provider wrapping Repository.watchOneNotifier which allows the watcher to be notified of changes on a specific model of this type, optionally reacting to selected relationships of this model via alsoWatch.

Example: Watch model of type books and id=1 along with its author relationship on a Riverpod hook-enabled app.

ref.books.watchOne(1, alsoWatch: (book) => []);


DataState<T?> watchOne(
  Object model, {
  bool? remote,
  Map<String, dynamic>? params,
  Map<String, String>? headers,
  AlsoWatch<T>? alsoWatch,
  String? finder,
  DataRequestLabel? label,
}) {
  final provider = watchOneProvider(
    remote: remote,
    params: params,
    headers: headers,
    alsoWatch: alsoWatch,
    finder: finder,
    label: label,
  return remoteAdapter.internalWatch!(provider);