mirror of
				https://github.com/h7x4/unofficial_jisho_api_dart.git
				synced 2025-10-31 01:43:36 +01:00 
			
		
		
		
	Add examples
This commit is contained in:
		
							
								
								
									
										19
									
								
								example/example_search_example.dart
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								example/example_search_example.dart
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | ||||
| import 'dart:convert' show jsonEncode; | ||||
| import 'package:unofficial_jisho_api/unofficial_jisho_api.dart'; | ||||
| final jisho = JishoApi(); | ||||
|  | ||||
| void main() async { | ||||
|   await jisho.searchForExamples('日').then((result) { | ||||
|     print('Jisho Uri: ' + result.uri); | ||||
|     print(''); | ||||
|  | ||||
|     for (int i = 0; i < 3; i++) { | ||||
|       var example = result.results[i]; | ||||
|       print(example.kanji); | ||||
|       print(example.kana); | ||||
|       print(example.english); | ||||
|       print(jsonEncode(example.pieces)); | ||||
|       print(''); | ||||
|     } | ||||
|   }); | ||||
| } | ||||
							
								
								
									
										24
									
								
								example/kanji_search_example.dart
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								example/kanji_search_example.dart
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,24 @@ | ||||
| import 'dart:convert' show jsonEncode; | ||||
| import 'package:unofficial_jisho_api/unofficial_jisho_api.dart'; | ||||
| final jisho = JishoApi(); | ||||
|  | ||||
| void main() async { | ||||
|   await jisho.searchForKanji('語').then((result) { | ||||
|     print('Found: ' + result.found.toString()); | ||||
|     print('Taught in: ' + result.taughtIn); | ||||
|     print('JLPT level: ' + result.jlptLevel); | ||||
|     print('Newspaper frequency rank: ' + result.newspaperFrequencyRank.toString()); | ||||
|     print('Stroke count: ' + result.strokeCount.toString()); | ||||
|     print('Meaning: ' + result.meaning); | ||||
|     print('Kunyomi: ' + jsonEncode(result.kunyomi)); | ||||
|     print('Kunyomi example: ' + jsonEncode(result.kunyomiExamples[0])); | ||||
|     print('Onyomi: ' + jsonEncode(result.onyomi)); | ||||
|     print('Onyomi example: ' + jsonEncode(result.onyomiExamples[0])); | ||||
|     print('Radical: ' + jsonEncode(result.radical)); | ||||
|     print('Parts: ' + jsonEncode(result.parts)); | ||||
|     print('Stroke order diagram: ' + result.strokeOrderDiagramUri); | ||||
|     print('Stroke order SVG: ' + result.strokeOrderSvgUri); | ||||
|     print('Stroke order GIF: ' + result.strokeOrderGifUri); | ||||
|     print('Jisho Uri: ' + result.uri); | ||||
|   }); | ||||
| } | ||||
							
								
								
									
										10
									
								
								example/phrase_scrape_example.dart
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								example/phrase_scrape_example.dart
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| import 'dart:convert'; | ||||
| import 'package:unofficial_jisho_api/unofficial_jisho_api.dart'; | ||||
| final jisho = JishoApi(); | ||||
| final encoder = JsonEncoder.withIndent(' '); | ||||
|  | ||||
| void main() async { | ||||
|   await jisho.scrapeForPhrase('谷').then((data) { | ||||
|     print(encoder.convert(data)); | ||||
|   }); | ||||
| } | ||||
| @@ -1,4 +0,0 @@ | ||||
| import 'package:unofficial_jisho_api/unofficial_jisho_api.dart'; | ||||
|  | ||||
| void main() { | ||||
| } | ||||
		Reference in New Issue
	
	Block a user