Add examples

This commit is contained in:
Oystein Kristoffer Tveit 2020-06-23 12:46:19 +02:00
parent fcabdb4ae4
commit dd1eaf6b5e
4 changed files with 53 additions and 4 deletions

View 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('');
}
});
}

View 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);
});
}

View 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));
});
}

View File

@ -1,4 +0,0 @@
import 'package:unofficial_jisho_api/unofficial_jisho_api.dart';
void main() {
}