Skip to content

Commit d55c583

Browse files
handle deleting instances
1 parent f4e52b9 commit d55c583

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

lib/features/sorting/heap/view/heap_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) => HeapSortNotifier(),
1010
);
1111

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

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

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

2621
@override
2722
Widget build(BuildContext context) {

lib/features/sorting/insertion/view/insertion_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) => InsertionSortNotifier(),
1010
);
1111

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

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

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

0 commit comments

Comments
 (0)