-
Notifications
You must be signed in to change notification settings - Fork 1
/
vocabulary.dart
57 lines (46 loc) · 1.49 KB
/
vocabulary.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:isar/isar.dart';
import 'package:kana_to_kanji/src/core/models/kanji_reading.dart';
part 'vocabulary.g.dart';
@collection
@Name("Vocabularies")
@JsonSerializable()
class Vocabulary {
final int id;
/// Contains the vocabulary word entirely even if it is a mix of kana and kanji.
final String kanji;
/// Full kana version of the word
final String kana;
@JsonKey(name: "jlpt_level")
final int jlptLevel;
/// Translations and meaning of the word
@Default([])
final List<String> meanings;
final String romaji;
/// List the IDs of the kanji present in the vocabulary.
/// Present when [kanji] isn't empty.
@Default([])
@JsonKey(name: "related_kanjis")
final List<int>? relatedKanjis;
final String version;
/// List of syllables forming the word in kana. Use to facilitate vocabulary sorting.
@JsonKey(name: "kana_syllables")
final List<String> kanaSyllables; // TODO: To remove once migrated to "kanjiReadings"
/// List of kanji which are in the vocabulary with their respective reading
@Default([])
@JsonKey(name: "kanji_readings")
final List<KanjiReading> kanjiReadings;
const Vocabulary(
this.id,
this.kanji,
this.kana,
this.jlptLevel,
this.meanings,
this.romaji,
this.relatedKanjis,
this.version,
this.kanaSyllables,
this.kanjiReadings);
factory Vocabulary.fromJson(Map<String, dynamic> json) =>
_$VocabularyFromJson(json);
}