Skip to content

Commit f4e52b9

Browse files
handle deleting instances
1 parent 5a94d40 commit f4e52b9

File tree

3 files changed

+9
-20
lines changed

3 files changed

+9
-20
lines changed

lib/features/sorting/bubble/view/bubble_sort_page.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ final _notifierProvider = StateNotifierProvider<SortingNotifier, SortingNotifier
99
(ref) => BubbleSortNotifier(),
1010
);
1111

12-
class BubbleSortPage extends ConsumerStatefulWidget {
12+
class BubbleSortPage extends StatefulWidget {
1313
const BubbleSortPage({super.key});
1414

1515
@override
16-
ConsumerState<BubbleSortPage> createState() => _BubbleSortPageState();
16+
State<BubbleSortPage> createState() => _BubbleSortPageState();
1717
}
1818

19-
class _BubbleSortPageState extends ConsumerState<BubbleSortPage> {
19+
class _BubbleSortPageState extends State<BubbleSortPage> {
2020
@override
2121
Widget build(BuildContext context) {
2222
return SortingPage(instance: _notifierProvider, title: StringsManager.bubbleSort);

lib/features/sorting/bucket/view/bucket_sort_page.dart

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,14 @@ final _notifierProvider = StateNotifierProvider<SortingNotifier, SortingNotifier
99
(ref) => BucketSortNotifier(),
1010
);
1111

12-
class BucketSortPage extends ConsumerStatefulWidget {
12+
class BucketSortPage extends StatefulWidget {
1313
const BucketSortPage({super.key});
1414

1515
@override
16-
ConsumerState<BucketSortPage> createState() => _BucketSortPageState();
16+
State<BucketSortPage> createState() => _BucketSortPageState();
1717
}
1818

19-
class _BucketSortPageState extends ConsumerState<BucketSortPage> {
20-
@override
21-
void deactivate() {
22-
ref.invalidate(_notifierProvider); // deletes current instance and resets
23-
super.deactivate();
24-
}
25-
19+
class _BucketSortPageState extends State<BucketSortPage> {
2620
@override
2721
Widget build(BuildContext context) {
2822
return SortingPage(instance: _notifierProvider, title: StringsManager.bucketSort);

lib/features/sorting/counting/view/counting_sort_page.dart

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,14 @@ final _notifierProvider = StateNotifierProvider<SortingNotifier, SortingNotifier
99
(ref) => CountingSortNotifier(),
1010
);
1111

12-
class CountingSortPage extends ConsumerStatefulWidget {
12+
class CountingSortPage extends StatefulWidget {
1313
const CountingSortPage({super.key});
1414

1515
@override
16-
ConsumerState<CountingSortPage> createState() => _CountingSortPageState();
16+
State<CountingSortPage> createState() => _CountingSortPageState();
1717
}
1818

19-
class _CountingSortPageState extends ConsumerState<CountingSortPage> {
20-
@override
21-
void deactivate() {
22-
ref.invalidate(_notifierProvider); // deletes current instance and resets
23-
super.deactivate();
24-
}
19+
class _CountingSortPageState extends State<CountingSortPage> {
2520

2621
@override
2722
Widget build(BuildContext context) {

0 commit comments

Comments
 (0)