write method

Future<void> write(
  1. BaseNarrativeModel sentence
)

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);
  }
}