Skip to content

Commit

Permalink
update throttling dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniil Marchenko committed Jan 30, 2024
1 parent 947ec58 commit 602260b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/implementations/debounce_lang_tool_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class DebounceLangToolService extends LanguageCheckService {
final LanguageCheckService baseService;

/// A debouncing used to debounce the API calls.
final Debouncing debouncing;
final Debouncing<Future<Result<List<Mistake>>?>> debouncing;

/// Creates a new instance of the [DebounceLangToolService] class.
DebounceLangToolService(
Expand All @@ -20,15 +20,15 @@ class DebounceLangToolService extends LanguageCheckService {
@override
Future<Result<List<Mistake>>> findMistakes(String text) async {
final value =
await debouncing.debounce(() => baseService.findMistakes(text))
(await debouncing.debounce(() => baseService.findMistakes(text)) ?? [])
as Result<List<Mistake>>;

return value;
}

@override
Future<void> dispose() async {
await debouncing.close();
debouncing.close();
await baseService.dispose();
}
}
2 changes: 1 addition & 1 deletion lib/implementations/throttling_lang_tool_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ThrottlingLangToolService extends LanguageCheckService {

@override
Future<void> dispose() async {
await throttling.close();
throttling.close();
await baseService.dispose();
}
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies:
flutter:
sdk: flutter
http: ^1.0.0
throttling: ^1.0.0
throttling: ^2.0.1

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit 602260b

Please sign in to comment.