watchOne method
DataState<T?>
watchOne(
- Object model, {
- bool remote = false,
- Map<
String, dynamic> ? params, - Map<
String, String> ? headers, - AlsoWatch<
T> ? alsoWatch, - String? finder,
- DataRequestLabel? label,
inherited
Watches a provider wrapping 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 = false,
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 internalWatch!(provider);
}