class YokutangoEntry { final List japanese; final List norwegian; const YokutangoEntry({required this.japanese, required this.norwegian}); YokutangoEntry.fromJson(Map json) : japanese = (json['japanese'] as List) .map((e) => JapaneseWord.fromJson(e)) .toList(), norwegian = (json['norwegian'] as List) .map((e) => NorwegianWord.fromJson(e)) .toList(); @override String toString() { return "${japanese.join(" ### ")} - ${norwegian.join(" ### ")}"; } YokutangoEntry.empty() : japanese = [JapaneseWord.empty()], norwegian = [NorwegianWord.empty()]; } class JapaneseWord { final String word; final String? romaji; final List? hints; const JapaneseWord({ required this.word, this.romaji, this.hints, }); JapaneseWord.fromJson(Map json) : word = json['word'], romaji = json['romaji'], hints = (json['hints'] as List?)?.map((e) => e as String).toList(); @override String toString() { return word + ((romaji != null) ? "/$romaji" : "") + ((hints != null) ? " (${hints!.join(", ")})" : ""); } JapaneseWord.empty() : word = "", romaji = "", hints = []; } class NorwegianWord { final String word; final List? hints; const NorwegianWord({required this.word, this.hints}); NorwegianWord.fromJson(Map json) : word = json['word'], hints = (json['hints'] as List?)?.map((e) => e as String).toList(); @override String toString() { return word + ((hints != null) ? " (${hints!.join(", ")})" : ""); } NorwegianWord.empty() : word = "", hints = []; }