diff --git a/pkgs/cupertino_http/example/lib/main.dart b/pkgs/cupertino_http/example/lib/main.dart index 2a3017d200..bb48cf7009 100644 --- a/pkgs/cupertino_http/example/lib/main.dart +++ b/pkgs/cupertino_http/example/lib/main.dart @@ -73,13 +73,12 @@ class _HomePageState extends State { } final books = await _findMatchingBooks(query); - if (query == _lastQuery) { - // Avoid the situation where a slow-running query finishes late and - // replaces newer search results. - setState(() { - _books = books; - }); - } + // Avoid the situation where a slow-running query finishes late and + // replaces newer search results. + if (query == _lastQuery) return; + setState(() { + _books = books; + }); } @override