unofficial_jisho_api_dart/example/api/kanji_search.dart

28 lines
1.1 KiB
Dart
Raw Normal View History

2020-06-23 12:46:19 +02:00
import 'dart:convert' show jsonEncode;
2020-06-25 22:42:16 +02:00
import 'package:unofficial_jisho_api/api.dart' as jisho;
2020-06-23 12:46:19 +02:00
2021-07-25 22:57:02 +02:00
void main() {
jisho.searchForKanji('').then((result) {
2020-06-26 01:59:23 +02:00
print('Found: ${result.found}');
2021-07-25 22:57:02 +02:00
final data = result.data;
if (data != null) {
print('Kanji: ${data.kanji}');
2021-07-25 22:57:02 +02:00
print('Taught in: ${data.taughtIn}');
print('JLPT level: ${data.jlptLevel}');
print('Newspaper frequency rank: ${data.newspaperFrequencyRank}');
print('Stroke count: ${data.strokeCount}');
print('Meaning: ${data.meaning}');
print('Kunyomi: ${jsonEncode(data.kunyomi)}');
print('Kunyomi example: ${jsonEncode(data.kunyomiExamples[0])}');
print('Onyomi: ${jsonEncode(data.onyomi)}');
print('Onyomi example: ${jsonEncode(data.onyomiExamples[0])}');
print('Radical: ${jsonEncode(data.radical)}');
print('Parts: ${jsonEncode(data.parts)}');
print('Stroke order diagram: ${data.strokeOrderDiagramUri}');
print('Stroke order SVG: ${data.strokeOrderSvgUri}');
print('Stroke order GIF: ${data.strokeOrderGifUri}');
print('Jisho Uri: ${data.uri}');
}
2020-06-23 12:46:19 +02:00
});
}