Skip to content

Commit 31ca44e

Browse files
handle deleting instances
1 parent b857100 commit 31ca44e

File tree

2 files changed

+6
-18
lines changed

2 files changed

+6
-18
lines changed

lib/features/sorting/radix/view/radix_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) => RadixSortNotifier(),
1010
);
1111

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

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

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

lib/features/sorting/selection/view/selection_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) => SelectionSortNotifier(),
1010
);
1111

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

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

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

0 commit comments

Comments
 (0)