Skip to content

Commit

Permalink
rename watch providers
Browse files Browse the repository at this point in the history
  • Loading branch information
frank06 committed May 10, 2024
1 parent e54a2e5 commit 3c9405b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
10 changes: 5 additions & 5 deletions lib/src/adapter/watch_adapter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ mixin _WatchAdapter<T extends DataModelMixin<T>> on _RemoteAdapter<T> {
String? finder,
DataRequestLabel? label,
}) {
final provider = watchOneProvider(
final provider = watchOneProviderById(
model,
remote: remote,
params: params,
Expand Down Expand Up @@ -89,7 +89,7 @@ mixin _WatchAdapter<T extends DataModelMixin<T>> on _RemoteAdapter<T> {
AlsoWatch<T>? alsoWatch,
String? finder,
DataRequestLabel? label}) {
return internalWatch!(watchOneProvider(
return internalWatch!(watchOneProviderById(
model,
remote: remote,
params: params,
Expand Down Expand Up @@ -473,7 +473,7 @@ mixin _WatchAdapter<T extends DataModelMixin<T>> on _RemoteAdapter<T> {
});

AutoDisposeStateNotifierProvider<DataStateNotifier<T?>, DataState<T?>>
watchOneProvider(
watchOneProviderById(
Object model, {
bool remote = false,
Map<String, dynamic>? params,
Expand All @@ -489,7 +489,7 @@ mixin _WatchAdapter<T extends DataModelMixin<T>> on _RemoteAdapter<T> {
.whereType<RelationshipMeta>()
.toImmutableList();

return _watchOneProvider(
return watchOneProvider(
WatchArgs(
key: key,
remote: remote,
Expand All @@ -503,7 +503,7 @@ mixin _WatchAdapter<T extends DataModelMixin<T>> on _RemoteAdapter<T> {
);
}

late final _watchOneProvider = StateNotifierProvider.autoDispose
late final watchOneProvider = StateNotifierProvider.autoDispose
.family<DataStateNotifier<T?>, DataState<T?>, WatchArgs<T>>((ref, args) {
return _watchOneNotifier(
args.key!,
Expand Down
5 changes: 3 additions & 2 deletions test/repository/remote_adapter_watch_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ void main() async {
final defaultNotifier = container.bookAuthors.watchOneNotifier(1);

final capsNotifier = container.read(container.bookAuthors
.watchOneProvider(bookAuthor, finder: 'caps')
.watchOneProviderById(bookAuthor, finder: 'caps')
.notifier);

final capsNotifier2 =
Expand All @@ -496,7 +496,8 @@ void main() async {
// similar tests without IDs
final p = Person(name: 'Daniel');
final p2 = Person(name: 'Bobby');
final pn1 = container.read(container.people.watchOneProvider(p).notifier);
final pn1 =
container.read(container.people.watchOneProviderById(p).notifier);
final pn1b = container.people.watchOneNotifier(p);
final pn2 = container.people.watchOneNotifier(p2);
expect(pn1, equals(pn1b));
Expand Down

0 comments on commit 3c9405b

Please sign in to comment.