unofficial_jisho_api_dart/example/parser/parse_kanji_page.dart

22 lines
648 B
Dart

import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:unofficial_jisho_api/parser.dart' as jisho_parser;
final JsonEncoder encoder = JsonEncoder.withIndent(' ');
const String searchKanji = '';
final Uri searchURI = jisho_parser.uriForKanjiSearch(searchKanji);
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}');
}
});
}