watchOne method
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) => [book.author]);
Implementation
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(
model,
remote: remote,
params: params,
headers: headers,
alsoWatch: alsoWatch,
finder: finder,
label: label,
);
return remoteAdapter.internalWatch!(provider);
}