Skip to content

Commit

Permalink
Fix: remove unused devtool hooks
Browse files Browse the repository at this point in the history
fixes #2003
  • Loading branch information
rrousselGit committed Dec 21, 2022
1 parent 0d1f47c commit 97e28b6
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 177 deletions.
1 change: 1 addition & 0 deletions packages/riverpod/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## [Unreleased patch]

- Update dependencies.
- fixes an exception on newer Dart versions

## 2.1.1

Expand Down
107 changes: 0 additions & 107 deletions packages/riverpod/lib/src/devtool.dart

This file was deleted.

1 change: 0 additions & 1 deletion packages/riverpod/lib/src/framework.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import 'dart:collection';

import 'package:meta/meta.dart';
import 'package:state_notifier/state_notifier.dart';
import 'devtool.dart';
import 'internals.dart';
import 'stack_trace.dart';

Expand Down
44 changes: 0 additions & 44 deletions packages/riverpod/lib/src/framework/container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ part of '../framework.dart';

ProviderBase? _circularDependencyLock;

int _debugNextId = 0;

class _FamilyOverrideRef {
_FamilyOverrideRef(this.override, this.container);

Expand Down Expand Up @@ -118,18 +116,6 @@ class ProviderContainer implements Node {
if (!entry.value.isDynamicallyCreated) entry.key: entry.value,
},
_root = parent?._root ?? parent {
assert(
() {
_debugId = '${_debugNextId++}';
RiverpodBinding.debugInstance.containers = {
...RiverpodBinding.debugInstance.containers,
_debugId: this,
};
return true;
}(),
'',
);

if (parent != null) {
parent._children.add(this);
_overrideForFamily.addAll(parent._overrideForFamily);
Expand Down Expand Up @@ -174,30 +160,10 @@ class ProviderContainer implements Node {
late final _ProviderScheduler _scheduler =
_parent?._scheduler ?? _ProviderScheduler();

late final String _debugId;

/// How deep this [ProviderContainer] is in the graph of containers.
///
/// Starts at 0.
final int depth;

/// A unique ID for this object, used by the devtool to differentiate two [ProviderContainer].
///
/// Should not be used.
@visibleForTesting
String get debugId {
String? id;
assert(
() {
id = _debugId;
return true;
}(),
'',
);

return id!;
}

final ProviderContainer? _root;
final ProviderContainer? _parent;

Expand Down Expand Up @@ -638,16 +604,6 @@ final b = Provider((ref) => ref.watch(a), dependencies: [a]);
return;
}

assert(
() {
RiverpodBinding.debugInstance.containers =
Map.from(RiverpodBinding.debugInstance.containers)
..remove(_debugId);
return true;
}(),
'',
);

_parent?._children.remove(this);

_disposed = true;
Expand Down
12 changes: 0 additions & 12 deletions packages/riverpod/lib/src/framework/element.dart
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,6 @@ abstract class ProviderElementBase<State> implements Ref<State>, Node {
_mounted = true;
assert(
() {
RiverpodBinding.debugInstance
.providerListChangedFor(containerId: container._debugId);

_debugCurrentCreateHash = provider.debugGetCreateSourceHash?.call();

return true;
Expand Down Expand Up @@ -855,15 +852,6 @@ The provider ${_debugCurrentlyBuildingElement!.origin} modified $origin while bu
@protected
@mustCallSuper
void dispose() {
assert(
() {
RiverpodBinding.debugInstance
.providerListChangedFor(containerId: container._debugId);
return true;
}(),
'',
);

runOnDispose();

// TODO test invalidateSelf() then dispose() properly unlinks dependencies
Expand Down
13 changes: 0 additions & 13 deletions packages/riverpod/test/matchers.dart

This file was deleted.

0 comments on commit 97e28b6

Please sign in to comment.