mirror of
				https://github.com/h7x4/unofficial_jisho_api_dart.git
				synced 2025-10-30 17:33:32 +01:00 
			
		
		
		
	Update code according to linter rules
This commit is contained in:
		
							
								
								
									
										17
									
								
								lib/api.dart
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								lib/api.dart
									
									
									
									
									
								
							| @@ -42,17 +42,12 @@ Future<ExampleResults> searchForExamples(String phrase) async { | |||||||
| /// instead of かかる (no results). | /// instead of かかる (no results). | ||||||
| Future<PhrasePageScrapeResult> scrapeForPhrase(String phrase) async { | Future<PhrasePageScrapeResult> scrapeForPhrase(String phrase) async { | ||||||
|   final uri = uriForPhraseScrape(phrase); |   final uri = uriForPhraseScrape(phrase); | ||||||
|   try { |  | ||||||
|   final response = await http.get(uri); |   final response = await http.get(uri); | ||||||
|     return parsePhrasePageData(response.body, phrase); |   if (response.statusCode == 404) { | ||||||
|   } catch (err) { |     return PhrasePageScrapeResult( | ||||||
|     // if (response.statusCode == 404) { |       query: phrase, | ||||||
|     //   return PhrasePageScrapeResult( |       found: false, | ||||||
|     //     query: phrase, |     ); | ||||||
|     //     found: false, |  | ||||||
|     //   ); |  | ||||||
|     // } |  | ||||||
|  |  | ||||||
|     rethrow; |  | ||||||
|   } |   } | ||||||
|  |   return parsePhrasePageData(response.body, phrase); | ||||||
| } | } | ||||||
| @@ -113,7 +113,7 @@ ExampleResults parseExamplePageData(String pageHtml, String phrase) { | |||||||
|   final document = parse(pageHtml); |   final document = parse(pageHtml); | ||||||
|   final divs = document.querySelectorAll('.sentence_content'); |   final divs = document.querySelectorAll('.sentence_content'); | ||||||
|  |  | ||||||
|   final results = divs.map((div) => _parseExampleDiv(div)).toList(); |   final results = divs.map(_parseExampleDiv).toList(); | ||||||
|  |  | ||||||
|   return ExampleResults( |   return ExampleResults( | ||||||
|     query: phrase, |     query: phrase, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user