Skip to content

Commit

Permalink
Fix inability to find mistake in the next lines
Browse files Browse the repository at this point in the history
  • Loading branch information
solid-danylokhvan committed Jul 6, 2023
1 parent 8e1ddc6 commit f92c7c9
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions lib/client/language_tool_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import 'package:languagetool_textfield/domain/writing_mistake.dart';
///
/// Read more @ https://languagetool.org/http-api/swagger-ui/#/
class LanguageToolClient {
/// A language code like en-US, de-DE, fr,
/// or auto to guess the language automatically
final String language;

/// Url of LanguageTool API.
static const _url = 'api.languagetoolplus.com';

Expand All @@ -18,20 +22,14 @@ class LanguageToolClient {
};

/// Constructor for [LanguageToolClient].
LanguageToolClient();
LanguageToolClient({this.language = 'auto'});

/// Checks the errors in text.
Future<List<WritingMistake>> check(
String text, {
String language = 'auto',
}) async {
final encodedText = Uri.encodeQueryComponent(text);
final encodedLanguage = Uri.encodeQueryComponent(language);

Future<List<WritingMistake>> check(String text) async {
final result = await http.post(
Uri.https(_url, 'v2/check', {
'text': encodedText,
'language': encodedLanguage,
'text': text,
'language': language,
'enabledOnly': 'false',
'level': 'default',
}),
Expand Down

0 comments on commit f92c7c9

Please sign in to comment.