diff --git a/lib/src/message_input.dart b/lib/src/message_input.dart index 7ba3e4b9..a4bfcd18 100644 --- a/lib/src/message_input.dart +++ b/lib/src/message_input.dart @@ -934,12 +934,10 @@ class MessageInputState extends State { if (visible) { _onChange(); } else { - if (_commandsOverlay != null) { - _commandsOverlay.remove(); - } - if (_mentionsOverlay != null) { - _mentionsOverlay.remove(); - } + _commandsOverlay?.remove(); + _commandsOverlay = null; + _mentionsOverlay?.remove(); + _mentionsOverlay = null; } }); }