Skip to content

Commit

Permalink
Merge pull request #340 from schultek/check
Browse files Browse the repository at this point in the history
fix formatting
  • Loading branch information
schultek authored Nov 23, 2024
2 parents 11a50b8 + 3c949d0 commit 87a2a63
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 44 deletions.
4 changes: 2 additions & 2 deletions examples/package_riverpod/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -494,10 +494,10 @@ packages:
dependency: transitive
description:
name: riverpod
sha256: f21b32ffd26a36555e501b04f4a5dca43ed59e16343f1a30c13632b2351dfa4d
sha256: "59062512288d3056b2321804332a13ffdd1bf16df70dcc8e506e411280a72959"
url: "https://pub.dev"
source: hosted
version: "2.5.1"
version: "2.6.1"
rxdart:
dependency: transitive
description:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ part of '../change_notifier_provider.dart';

/// {@macro riverpod.provider_ref_base}
@Deprecated('will be removed in 3.0.0, use Ref instead')
abstract class AutoDisposeChangeNotifierProviderRef<
NotifierT extends ChangeNotifier?>
extends ChangeNotifierProviderRef<NotifierT>
implements AutoDisposeRef<NotifierT> {}
abstract class AutoDisposeChangeNotifierProviderRef<NotifierT extends ChangeNotifier?>
extends ChangeNotifierProviderRef<NotifierT> implements AutoDisposeRef<NotifierT> {}

// ignore: subtype_of_sealed_class
/// {@macro riverpod.change_notifier_provider}
Expand All @@ -22,8 +20,7 @@ class AutoDisposeChangeNotifierProvider<NotifierT extends ChangeNotifier?>
@Deprecated('Will be removed in 3.0.0') super.argument,
@Deprecated('Will be removed in 3.0.0') super.debugGetCreateSourceHash,
}) : super(
allTransitiveDependencies:
computeAllTransitiveDependencies(dependencies),
allTransitiveDependencies: computeAllTransitiveDependencies(dependencies),
);

/// An implementation detail of Riverpod
Expand Down Expand Up @@ -86,8 +83,7 @@ class AutoDisposeChangeNotifierProvider<NotifierT extends ChangeNotifier?>

/// The element of [AutoDisposeChangeNotifierProvider].
@Deprecated('will be removed in 3.0.0, use Ref instead')
class AutoDisposeChangeNotifierProviderElement<
NotifierT extends ChangeNotifier?>
class AutoDisposeChangeNotifierProviderElement<NotifierT extends ChangeNotifier?>
extends ChangeNotifierProviderElement<NotifierT>
with AutoDisposeProviderElementMixin<NotifierT>
implements AutoDisposeChangeNotifierProviderRef<NotifierT> {
Expand All @@ -100,14 +96,13 @@ class AutoDisposeChangeNotifierProviderElement<

// ignore: subtype_of_sealed_class
/// The [Family] of [AutoDisposeChangeNotifierProvider].
class AutoDisposeChangeNotifierProviderFamily<NotifierT extends ChangeNotifier?, Arg>
extends AutoDisposeFamilyBase<
// ignore: deprecated_member_use_from_same_package
AutoDisposeChangeNotifierProviderRef<NotifierT>,
NotifierT,
Arg,
NotifierT,
AutoDisposeChangeNotifierProvider<NotifierT>> {
class AutoDisposeChangeNotifierProviderFamily<NotifierT extends ChangeNotifier?, Arg> extends AutoDisposeFamilyBase<
// ignore: deprecated_member_use_from_same_package
AutoDisposeChangeNotifierProviderRef<NotifierT>,
NotifierT,
Arg,
NotifierT,
AutoDisposeChangeNotifierProvider<NotifierT>> {
/// The [Family] of [AutoDisposeChangeNotifierProvider].
AutoDisposeChangeNotifierProviderFamily(
super._createFn, {
Expand All @@ -116,8 +111,7 @@ class AutoDisposeChangeNotifierProviderFamily<NotifierT extends ChangeNotifier?,
}) : super(
providerFactory: AutoDisposeChangeNotifierProvider.internal,
debugGetCreateSourceHash: null,
allTransitiveDependencies:
computeAllTransitiveDependencies(dependencies),
allTransitiveDependencies: computeAllTransitiveDependencies(dependencies),
);

/// {@macro riverpod.override_with}
Expand All @@ -128,8 +122,7 @@ class AutoDisposeChangeNotifierProviderFamily<NotifierT extends ChangeNotifier?,
Arg arg,
) create,
) {
return FamilyOverrideImpl<NotifierT, Arg,
AutoDisposeChangeNotifierProvider<NotifierT>>(
return FamilyOverrideImpl<NotifierT, Arg, AutoDisposeChangeNotifierProvider<NotifierT>>(
this,
(arg) => AutoDisposeChangeNotifierProvider<NotifierT>.internal(
(ref) => create(ref, arg),
Expand Down
34 changes: 12 additions & 22 deletions packages/jaspr_riverpod/lib/src/change_notifier_provider/base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ part of '../change_notifier_provider.dart';

/// {@macro riverpod.provider_ref_base}
@Deprecated('will be removed in 3.0.0. Use Ref instead')
abstract class ChangeNotifierProviderRef<NotifierT extends ChangeNotifier?>
implements Ref<NotifierT> {
abstract class ChangeNotifierProviderRef<NotifierT extends ChangeNotifier?> implements Ref<NotifierT> {
/// The [ChangeNotifier] currently exposed by this provider.
///
/// Cannot be accessed while creating the provider.
Expand Down Expand Up @@ -74,8 +73,7 @@ abstract class ChangeNotifierProviderRef<NotifierT extends ChangeNotifier?>
/// }
/// ```
/// {@endtemplate}
class ChangeNotifierProvider<NotifierT extends ChangeNotifier?>
extends _ChangeNotifierProviderBase<NotifierT>
class ChangeNotifierProvider<NotifierT extends ChangeNotifier?> extends _ChangeNotifierProviderBase<NotifierT>
with
// ignore: deprecated_member_use
AlwaysAliveProviderBase<NotifierT> {
Expand All @@ -88,8 +86,7 @@ class ChangeNotifierProvider<NotifierT extends ChangeNotifier?>
@Deprecated('Will be removed in 3.0.0') super.argument,
@Deprecated('Will be removed in 3.0.0') super.debugGetCreateSourceHash,
}) : super(
allTransitiveDependencies:
computeAllTransitiveDependencies(dependencies),
allTransitiveDependencies: computeAllTransitiveDependencies(dependencies),
);

/// An implementation detail of Riverpod
Expand Down Expand Up @@ -127,8 +124,7 @@ class ChangeNotifierProvider<NotifierT extends ChangeNotifier?>

@override
// ignore: deprecated_member_use, deprecated_member_use_from_same_package
late final AlwaysAliveRefreshable<NotifierT> notifier =
_notifier<NotifierT>(this);
late final AlwaysAliveRefreshable<NotifierT> notifier = _notifier<NotifierT>(this);

/// {@template riverpod.override_with}
/// Override the provider with a new initialization function.
Expand Down Expand Up @@ -184,8 +180,7 @@ class ChangeNotifierProvider<NotifierT extends ChangeNotifier?>
}

/// The element of [ChangeNotifierProvider].
class ChangeNotifierProviderElement<NotifierT extends ChangeNotifier?>
extends ProviderElementBase<NotifierT>
class ChangeNotifierProviderElement<NotifierT extends ChangeNotifier?> extends ProviderElementBase<NotifierT>
// ignore: deprecated_member_use, deprecated_member_use_from_same_package
implements
// ignore: deprecated_member_use, deprecated_member_use_from_same_package
Expand All @@ -204,8 +199,7 @@ class ChangeNotifierProviderElement<NotifierT extends ChangeNotifier?>
void create({required bool didChangeDependency}) {
final provider = this.provider as _ChangeNotifierProviderBase<NotifierT>;

final notifierResult =
_notifierNotifier.result = Result.guard(() => provider._create(this));
final notifierResult = _notifierNotifier.result = Result.guard(() => provider._create(this));

// TODO test requireState, as ref.read(p) is expected to throw if notifier creation failed
final notifier = notifierResult.requireState;
Expand Down Expand Up @@ -240,8 +234,7 @@ class ChangeNotifierProviderElement<NotifierT extends ChangeNotifier?>
@override
void visitChildren({
required void Function(ProviderElementBase<Object?> element) elementVisitor,
required void Function(ProxyElementValueNotifier<Object?> element)
notifierVisitor,
required void Function(ProxyElementValueNotifier<Object?> element) notifierVisitor,
}) {
super.visitChildren(
elementVisitor: elementVisitor,
Expand All @@ -255,8 +248,8 @@ class ChangeNotifierProviderElement<NotifierT extends ChangeNotifier?>
/// The [Family] of [ChangeNotifierProvider].
class ChangeNotifierProviderFamily<NotifierT extends ChangeNotifier?, Arg>
// ignore: deprecated_member_use, deprecated_member_use_from_same_package
extends FamilyBase<ChangeNotifierProviderRef<NotifierT>, NotifierT, Arg,
NotifierT, ChangeNotifierProvider<NotifierT>> {
extends FamilyBase<ChangeNotifierProviderRef<NotifierT>, NotifierT, Arg, NotifierT,
ChangeNotifierProvider<NotifierT>> {
/// The [Family] of [ChangeNotifierProvider].
ChangeNotifierProviderFamily(
super._createFn, {
Expand All @@ -265,18 +258,15 @@ class ChangeNotifierProviderFamily<NotifierT extends ChangeNotifier?, Arg>
}) : super(
providerFactory: ChangeNotifierProvider.internal,
debugGetCreateSourceHash: null,
allTransitiveDependencies:
computeAllTransitiveDependencies(dependencies),
allTransitiveDependencies: computeAllTransitiveDependencies(dependencies),
);

/// {@macro riverpod.override_with}
Override overrideWith(
// ignore: deprecated_member_use, deprecated_member_use_from_same_package
NotifierT Function(ChangeNotifierProviderRef<NotifierT> ref, Arg arg)
create,
NotifierT Function(ChangeNotifierProviderRef<NotifierT> ref, Arg arg) create,
) {
return FamilyOverrideImpl<NotifierT, Arg,
ChangeNotifierProvider<NotifierT>>(
return FamilyOverrideImpl<NotifierT, Arg, ChangeNotifierProvider<NotifierT>>(
this,
(arg) => ChangeNotifierProvider<NotifierT>.internal(
(ref) => create(ref, arg),
Expand Down

0 comments on commit 87a2a63

Please sign in to comment.