mirror of
https://github.com/h7x4/unofficial_jisho_api_dart.git
synced 2025-09-21 04:55:56 +02:00
Update code according to linter rules
This commit is contained in:
19
lib/api.dart
19
lib/api.dart
@@ -42,17 +42,12 @@ Future<ExampleResults> searchForExamples(String phrase) async {
|
||||
/// instead of かかる (no results).
|
||||
Future<PhrasePageScrapeResult> scrapeForPhrase(String phrase) async {
|
||||
final uri = uriForPhraseScrape(phrase);
|
||||
try {
|
||||
final response = await http.get(uri);
|
||||
return parsePhrasePageData(response.body, phrase);
|
||||
} catch (err) {
|
||||
// if (response.statusCode == 404) {
|
||||
// return PhrasePageScrapeResult(
|
||||
// query: phrase,
|
||||
// found: false,
|
||||
// );
|
||||
// }
|
||||
|
||||
rethrow;
|
||||
final response = await http.get(uri);
|
||||
if (response.statusCode == 404) {
|
||||
return PhrasePageScrapeResult(
|
||||
query: phrase,
|
||||
found: false,
|
||||
);
|
||||
}
|
||||
return parsePhrasePageData(response.body, phrase);
|
||||
}
|
Reference in New Issue
Block a user