Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix family.overrideWith cast error and include family arguments in the ref #2852

Merged
merged 11 commits into from
Aug 28, 2023
5 changes: 2 additions & 3 deletions examples/counter/lib/main.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

122 changes: 108 additions & 14 deletions examples/pub/lib/detail.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 60 additions & 6 deletions examples/pub/lib/search.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions packages/riverpod/lib/src/async_notifier/auto_dispose.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,17 @@ class AutoDisposeAsyncNotifierProviderImpl<

@override
AutoDisposeAsyncNotifierProviderElement<NotifierT, T> createElement() {
return AutoDisposeAsyncNotifierProviderElement._(this);
return AutoDisposeAsyncNotifierProviderElement(this);
}

@override
@mustBeOverridden
FutureOr<T> runNotifierBuild(AsyncNotifierBase<T> notifier) {
return (notifier as AutoDisposeAsyncNotifier<T>).build();
}

/// {@macro riverpod.overridewith}
@mustBeOverridden
Override overrideWith(NotifierT Function() create) {
return ProviderOverride(
origin: this,
Expand All @@ -119,5 +121,6 @@ class AutoDisposeAsyncNotifierProviderElement<
with AutoDisposeProviderElementMixin<AsyncValue<T>>
implements AutoDisposeAsyncNotifierProviderRef<T> {
/// The [ProviderElementBase] for [AsyncNotifierProvider]
AutoDisposeAsyncNotifierProviderElement._(super._provider) : super._();
@internal
AutoDisposeAsyncNotifierProviderElement(super._provider) : super();
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class AutoDisposeFamilyAsyncNotifierProviderImpl<

@override
AutoDisposeAsyncNotifierProviderElement<NotifierT, T> createElement() {
return AutoDisposeAsyncNotifierProviderElement._(this);
return AutoDisposeAsyncNotifierProviderElement(this);
}

@override
Expand Down
14 changes: 10 additions & 4 deletions packages/riverpod/lib/src/async_notifier/base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,17 @@ class AsyncNotifierProviderImpl<NotifierT extends AsyncNotifierBase<T>, T>

@override
AsyncNotifierProviderElement<NotifierT, T> createElement() {
return AsyncNotifierProviderElement._(this);
return AsyncNotifierProviderElement(this);
}

@override
@mustBeOverridden
FutureOr<T> runNotifierBuild(AsyncNotifierBase<T> notifier) {
return (notifier as AsyncNotifier<T>).build();
}

/// {@macro riverpod.overridewith}
@mustBeOverridden
Override overrideWith(NotifierT Function() create) {
return ProviderOverride(
origin: this,
Expand Down Expand Up @@ -472,7 +474,9 @@ abstract class AsyncNotifierProviderElementBase<
NotifierT extends AsyncNotifierBase<T>,
T> extends ProviderElementBase<AsyncValue<T>>
with FutureHandlerProviderElementMixin<T> {
AsyncNotifierProviderElementBase._(super._provider);
/// The element of [AsyncNotifierProvider].
@internal
AsyncNotifierProviderElementBase(super._provider);

final _notifierNotifier = ProxyElementValueNotifier<NotifierT>();

Expand Down Expand Up @@ -501,9 +505,11 @@ abstract class AsyncNotifierProviderElementBase<
class AsyncNotifierProviderElement<NotifierT extends AsyncNotifierBase<T>, T>
extends AsyncNotifierProviderElementBase<NotifierT, T>
implements AsyncNotifierProviderRef<T> {
AsyncNotifierProviderElement._(
/// The element of [AsyncNotifierProvider].
@internal
AsyncNotifierProviderElement(
AsyncNotifierProviderBase<NotifierT, T> super._provider,
) : super._();
);

@override
void create({required bool didChangeDependency}) {
Expand Down
2 changes: 1 addition & 1 deletion packages/riverpod/lib/src/async_notifier/family.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class FamilyAsyncNotifierProviderImpl<NotifierT extends AsyncNotifierBase<T>, T,

@override
AsyncNotifierProviderElement<NotifierT, T> createElement() {
return AsyncNotifierProviderElement._(this);
return AsyncNotifierProviderElement(this);
}

@override
Expand Down
Loading
Loading