write method
Writes a sentence only if it differs from the last one.
Compares both text and instruction fields.
Implementation
Future<void> write(BaseNarrativeModel sentence) async {
final isDuplicate = _last?.text == sentence.text &&
_last?.instruction == sentence.instruction;
if (!isDuplicate) {
_last = sentence;
await _delegate(sentence);
}
}