remove method
Removes the popup, being shown via this controller.
If no popup is being shown via this controller then, this will throw error.
Implementation
Future<void> remove() async {
if (!_mounted) {
throw PlatformException(
code: 'NO_POPUP',
message: 'No popup as added to remove',
);
}
if (_animationController != null) {
await _animationController!.setValue(true);
_animationController!.dispose();
_animationController = null;
}
onDismiss?.call();
if (_overlayEntry != null) return _overlayEntry!.remove();
key?.currentState?.removePopup(id);
_mounted = false;
}