Committed by
GitHub
Merge pull request #1594 from furkankurt/bottomsheet-dispose
Added dispose() for bottomSheet.
Showing
1 changed file
with
11 additions
and
0 deletions
1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
2 | +import '../../../get_core/get_core.dart'; | ||
3 | +import '../../../get_instance/src/get_instance.dart'; | ||
2 | 4 | ||
3 | class GetModalBottomSheetRoute<T> extends PopupRoute<T> { | 5 | class GetModalBottomSheetRoute<T> extends PopupRoute<T> { |
4 | GetModalBottomSheetRoute({ | 6 | GetModalBottomSheetRoute({ |
@@ -52,6 +54,15 @@ class GetModalBottomSheetRoute<T> extends PopupRoute<T> { | @@ -52,6 +54,15 @@ class GetModalBottomSheetRoute<T> extends PopupRoute<T> { | ||
52 | AnimationController? _animationController; | 54 | AnimationController? _animationController; |
53 | 55 | ||
54 | @override | 56 | @override |
57 | + void dispose() { | ||
58 | + if (Get.smartManagement != SmartManagement.onlyBuilder) { | ||
59 | + WidgetsBinding.instance!.addPostFrameCallback( | ||
60 | + (_) => GetInstance().removeDependencyByRoute(name)); | ||
61 | + } | ||
62 | + super.dispose(); | ||
63 | + } | ||
64 | + | ||
65 | + @override | ||
55 | AnimationController createAnimationController() { | 66 | AnimationController createAnimationController() { |
56 | assert(_animationController == null); | 67 | assert(_animationController == null); |
57 | _animationController = | 68 | _animationController = |
-
Please register or login to post a comment