opt.: replace first with firstOrNull

This commit is contained in:
lollipopkit
2024-03-06 15:33:00 +08:00
parent fc00b4b961
commit 602ef60bf0
7 changed files with 11 additions and 9 deletions

View File

@@ -287,7 +287,8 @@ class _SSHPageState extends State<SSHPage> with AutomaticKeepAliveClientMixin {
);
if (snippets == null || snippets.isEmpty) return;
final snippet = snippets.first;
final snippet = snippets.firstOrNull;
if (snippet == null) return;
_terminal.textInput(snippet.script);
_terminal.keyInput(TerminalKey.enter);
break;