Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

Commit

Permalink
refactor: _suggestionsBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
Craftplacer committed Feb 4, 2024
1 parent 75fc92b commit f62850e
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/kaiteki/lib/ui/main/main_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -309,15 +309,13 @@ class MainScreenState extends ConsumerState<MainScreen> {
BuildContext context,
SearchController controller,
) async {
final l10n = context.l10n;
final adapter = ref.watch(adapterProvider) as SearchSupport;

if (controller.text.trim().isEmpty) return [];

final results = await _searchDebounce(controller.text);
final query = controller.text.trim();
if (query.isEmpty) return [];

final results = await _searchDebounce(query);
if (results == null) return [];

final l10n = context.l10n;

Check notice on line 318 in src/kaiteki/lib/ui/main/main_screen.dart

View workflow job for this annotation

GitHub Actions / Test

Don't use 'BuildContext's across async gaps.

Try rewriting the code to not use the 'BuildContext', or guard the use with a 'mounted' check. See https://dart.dev/lints/use_build_context_synchronously to learn more about this problem.
if (results.users.isEmpty &&
results.posts.isEmpty &&
results.hashtags.isEmpty) {
Expand Down

0 comments on commit f62850e

Please sign in to comment.