2020-06-25 23:01:38 +02:00
|
|
|
import 'dart:convert';
|
2020-06-26 01:59:23 +02:00
|
|
|
import 'package:http/http.dart' as http;
|
2020-06-25 23:01:38 +02:00
|
|
|
import 'package:unofficial_jisho_api/parser.dart' as jisho_parser;
|
|
|
|
|
2020-06-26 01:59:23 +02:00
|
|
|
final JsonEncoder encoder = JsonEncoder.withIndent(' ');
|
2020-06-25 23:01:38 +02:00
|
|
|
|
2020-06-26 01:59:23 +02:00
|
|
|
const String searchKanji = '車';
|
2021-07-25 22:57:02 +02:00
|
|
|
final Uri searchURI = jisho_parser.uriForKanjiSearch(searchKanji);
|
2020-06-25 23:01:38 +02:00
|
|
|
|
2021-07-25 22:57:02 +02:00
|
|
|
void main() {
|
|
|
|
http.get(searchURI).then((result) {
|
|
|
|
final parsedResult =
|
|
|
|
jisho_parser.parseKanjiPageData(result.body, searchKanji);
|
|
|
|
final data = parsedResult.data;
|
|
|
|
if (data != null) {
|
|
|
|
print('JLPT level: ${data.jlptLevel}');
|
|
|
|
print('Stroke count: ${data.strokeCount}');
|
|
|
|
print('Meaning: ${data.meaning}');
|
|
|
|
}
|
2020-06-25 23:01:38 +02:00
|
|
|
});
|
2021-07-25 22:57:02 +02:00
|
|
|
}
|