You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
fluffychat/lib/pangea/models/lemma.dart

25 lines
626 B
Dart

class Lemma {
final String text;
final String form;
final bool saveVocab;
Lemma({required this.text, required this.saveVocab, required this.form});
factory Lemma.fromJson(Map<String, dynamic> json) {
return Lemma(
text: json['text'],
saveVocab: json['save_vocab'] ?? json['saveVocab'] ?? false,
form: json["form"] ?? json['text'],
);
}
toJson() {
return {'text': text, 'save_vocab': saveVocab, 'form': form};
}
static Lemma get empty => Lemma(text: '', saveVocab: true, form: '');
static Lemma create(String form) =>
Lemma(text: '', saveVocab: true, form: form);
}