Unify json null returns
This commit is contained in:
parent
5d7b7696d7
commit
d65550a502
|
@ -24,7 +24,7 @@ List<Element> getChildrenAndSymbols(Element ul) {
|
||||||
symbols += ulCharArray[offsetPointer];
|
symbols += ulCharArray[offsetPointer];
|
||||||
offsetPointer++;
|
offsetPointer++;
|
||||||
}
|
}
|
||||||
final symbolElement = Element.html('<span>' + symbols + '</span>');
|
final symbolElement = Element.html('<span>${symbols}</span>');
|
||||||
result.add(symbolElement);
|
result.add(symbolElement);
|
||||||
}
|
}
|
||||||
offsetPointer += element.text.length;
|
offsetPointer += element.text.length;
|
||||||
|
@ -32,7 +32,7 @@ List<Element> getChildrenAndSymbols(Element ul) {
|
||||||
}
|
}
|
||||||
if (offsetPointer + 1 != ulText.length){
|
if (offsetPointer + 1 != ulText.length){
|
||||||
final symbols = ulText.substring(offsetPointer, ulText.length-1);
|
final symbols = ulText.substring(offsetPointer, ulText.length-1);
|
||||||
final symbolElement = Element.html('<span>' + symbols + '</span>');
|
final symbolElement = Element.html('<span>${symbols}</span>');
|
||||||
result.add(symbolElement);
|
result.add(symbolElement);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -7,12 +7,11 @@ class YomiExample {
|
||||||
String reading;
|
String reading;
|
||||||
String meaning;
|
String meaning;
|
||||||
|
|
||||||
YomiExample({String example, String reading, String meaning})
|
YomiExample({
|
||||||
{
|
this.example,
|
||||||
this.example = example;
|
this.reading,
|
||||||
this.reading = reading;
|
this.meaning
|
||||||
this.meaning = meaning;
|
});
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, String> toJson() =>
|
Map<String, String> toJson() =>
|
||||||
{
|
{
|
||||||
|
@ -28,11 +27,11 @@ class Radical {
|
||||||
List<String> forms;
|
List<String> forms;
|
||||||
String meaning;
|
String meaning;
|
||||||
|
|
||||||
Radical({String symbol, List<String> forms, String meaning}){
|
Radical({
|
||||||
this.symbol = symbol;
|
this.symbol,
|
||||||
this.forms = forms;
|
this.forms,
|
||||||
this.meaning = meaning;
|
this.meaning
|
||||||
}
|
});
|
||||||
|
|
||||||
Map<String, dynamic> toJson() =>
|
Map<String, dynamic> toJson() =>
|
||||||
{
|
{
|
||||||
|
@ -63,16 +62,28 @@ class KanjiResult {
|
||||||
String strokeOrderGifUri;
|
String strokeOrderGifUri;
|
||||||
String uri;
|
String uri;
|
||||||
|
|
||||||
|
KanjiResult({
|
||||||
|
this.query,
|
||||||
|
this.found,
|
||||||
|
this.taughtIn,
|
||||||
|
this.jlptLevel,
|
||||||
|
this.newspaperFrequencyRank,
|
||||||
|
this.strokeCount,
|
||||||
|
this.meaning,
|
||||||
|
this.kunyomi,
|
||||||
|
this.onyomi,
|
||||||
|
this.kunyomiExamples,
|
||||||
|
this.onyomiExamples,
|
||||||
|
this.radical,
|
||||||
|
this.parts,
|
||||||
|
this.strokeOrderDiagramUri,
|
||||||
|
this.strokeOrderSvgUri,
|
||||||
|
this.strokeOrderGifUri,
|
||||||
|
this.uri
|
||||||
|
});
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
|
return {
|
||||||
if (found == false) {
|
|
||||||
return {
|
|
||||||
'query': query,
|
|
||||||
'found': found
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
var returnObject = {
|
|
||||||
'query': query,
|
'query': query,
|
||||||
'found': found,
|
'found': found,
|
||||||
'taughtIn': taughtIn,
|
'taughtIn': taughtIn,
|
||||||
|
@ -84,15 +95,13 @@ class KanjiResult {
|
||||||
'onyomi': onyomi,
|
'onyomi': onyomi,
|
||||||
'onyomiExamples': onyomiExamples,
|
'onyomiExamples': onyomiExamples,
|
||||||
'kunyomiExamples': kunyomiExamples,
|
'kunyomiExamples': kunyomiExamples,
|
||||||
'radical': radical.toJson(),
|
'radical': (radical != null) ? radical.toJson() : null,
|
||||||
'parts': parts,
|
'parts': parts,
|
||||||
'strokeOrderDiagramUri': strokeOrderDiagramUri,
|
'strokeOrderDiagramUri': strokeOrderDiagramUri,
|
||||||
'strokeOrderSvgUri': strokeOrderSvgUri,
|
'strokeOrderSvgUri': strokeOrderSvgUri,
|
||||||
'strokeOrderGifUri': strokeOrderGifUri,
|
'strokeOrderGifUri': strokeOrderGifUri,
|
||||||
'uri': uri
|
'uri': uri
|
||||||
};
|
};
|
||||||
|
|
||||||
return returnObject;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,10 +113,10 @@ class ExampleSentencePiece {
|
||||||
String lifted;
|
String lifted;
|
||||||
String unlifted;
|
String unlifted;
|
||||||
|
|
||||||
ExampleSentencePiece({String lifted, String unlifted}){
|
ExampleSentencePiece({
|
||||||
this.lifted = lifted;
|
this.lifted,
|
||||||
this.unlifted = unlifted;
|
this.unlifted
|
||||||
}
|
});
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
return {
|
return {
|
||||||
|
@ -123,12 +132,12 @@ class ExampleResultData {
|
||||||
String english;
|
String english;
|
||||||
List<ExampleSentencePiece> pieces;
|
List<ExampleSentencePiece> pieces;
|
||||||
|
|
||||||
ExampleResultData({String english, String kanji, String kana, List<ExampleSentencePiece> pieces}){
|
ExampleResultData({
|
||||||
this.english = english;
|
this.english,
|
||||||
this.kanji = kanji;
|
this.kanji,
|
||||||
this.kana = kana;
|
this.kana,
|
||||||
this.pieces = pieces;
|
this.pieces
|
||||||
}
|
});
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
return {
|
return {
|
||||||
|
@ -147,13 +156,13 @@ class ExampleResults {
|
||||||
List<ExampleResultData> results;
|
List<ExampleResultData> results;
|
||||||
String phrase;
|
String phrase;
|
||||||
|
|
||||||
ExampleResults({String query, bool found, List<ExampleResultData> results, String uri, String phrase}){
|
ExampleResults({
|
||||||
this.query = query;
|
this.query,
|
||||||
this.found = found;
|
this.found,
|
||||||
this.results = results;
|
this.results,
|
||||||
this.uri = uri;
|
this.uri,
|
||||||
this.phrase = phrase;
|
this.phrase
|
||||||
}
|
});
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
return {
|
return {
|
||||||
|
@ -175,11 +184,11 @@ class PhraseScrapeSentence {
|
||||||
String japanese;
|
String japanese;
|
||||||
List<ExampleSentencePiece> pieces;
|
List<ExampleSentencePiece> pieces;
|
||||||
|
|
||||||
PhraseScrapeSentence ({String english, String japanese, List<ExampleSentencePiece> pieces}){
|
PhraseScrapeSentence ({
|
||||||
this.english = english;
|
this.english,
|
||||||
this.japanese = japanese;
|
this.japanese,
|
||||||
this.pieces = pieces;
|
this.pieces
|
||||||
}
|
});
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
'english': english,
|
'english': english,
|
||||||
|
@ -197,21 +206,13 @@ class PhraseScrapeMeaning {
|
||||||
List<String> tags;
|
List<String> tags;
|
||||||
|
|
||||||
PhraseScrapeMeaning({
|
PhraseScrapeMeaning({
|
||||||
List<String> seeAlsoTerms,
|
this.seeAlsoTerms,
|
||||||
List<PhraseScrapeSentence> sentences,
|
this.sentences,
|
||||||
String definition,
|
this.definition,
|
||||||
List<String> supplemental,
|
this.supplemental,
|
||||||
String definitionAbstract,
|
this.definitionAbstract,
|
||||||
List<String> tags,
|
this.tags
|
||||||
}){
|
});
|
||||||
this.seeAlsoTerms = seeAlsoTerms;
|
|
||||||
this.sentences = sentences;
|
|
||||||
this.definition = definition;
|
|
||||||
this.supplemental = supplemental;
|
|
||||||
this.definitionAbstract = definitionAbstract;
|
|
||||||
this.tags = tags;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
'seeAlsoTerms': seeAlsoTerms,
|
'seeAlsoTerms': seeAlsoTerms,
|
||||||
|
@ -228,12 +229,9 @@ class KanjiKanaPair {
|
||||||
String kana;
|
String kana;
|
||||||
|
|
||||||
KanjiKanaPair({
|
KanjiKanaPair({
|
||||||
String kanji,
|
this.kanji,
|
||||||
String kana
|
this.kana
|
||||||
}){
|
});
|
||||||
this.kanji = kanji;
|
|
||||||
this.kana = kana;
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, String> toJson() => {
|
Map<String, String> toJson() => {
|
||||||
'kanji': kanji,
|
'kanji': kanji,
|
||||||
|
@ -251,22 +249,14 @@ class PhrasePageScrapeResult {
|
||||||
List<String> notes;
|
List<String> notes;
|
||||||
|
|
||||||
PhrasePageScrapeResult({
|
PhrasePageScrapeResult({
|
||||||
bool found,
|
this.found,
|
||||||
String query,
|
this.query,
|
||||||
String uri,
|
this.uri,
|
||||||
List<String> tags,
|
this.tags,
|
||||||
List<PhraseScrapeMeaning> meanings,
|
this.meanings,
|
||||||
List<KanjiKanaPair> otherForms,
|
this.otherForms,
|
||||||
List<String> notes,
|
this.notes
|
||||||
}){
|
});
|
||||||
this.found = found;
|
|
||||||
this.query = query;
|
|
||||||
this.uri = uri;
|
|
||||||
this.tags = tags;
|
|
||||||
this.meanings = meanings;
|
|
||||||
this.otherForms = otherForms;
|
|
||||||
this.notes = notes;
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() =>
|
Map<String, dynamic> toJson() =>
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue