TtsEvent constructor

TtsEvent({
  1. required EventType type,
  2. int? charIndex,
  3. String? errorMessage,
  4. double? srcId,
  5. bool? isFinalEvent,
  6. int? length,
})

Implementation

TtsEvent({
  /// The type can be `start` as soon as speech has started, `word` when a
  /// word boundary is reached, `sentence` when a sentence boundary is
  /// reached, `marker` when an SSML mark element is reached, `end` when the
  /// end of the utterance is reached, `interrupted` when the utterance is
  /// stopped or interrupted before reaching the end, `cancelled` when it's
  /// removed from the queue before ever being synthesized, or `error` when
  /// any other error occurs. When pausing speech, a `pause` event is fired if
  /// a particular utterance is paused in the middle, and `resume` if an
  /// utterance resumes speech. Note that pause and resume events may not fire
  /// if speech is paused in-between utterances.
  required EventType type,

  /// The index of the current character in the utterance. For word events,
  /// the event fires at the end of one word and before the beginning of the
  /// next. The `charIndex` represents a point in the text at the beginning of
  /// the next word to be spoken.
  int? charIndex,

  /// The error description, if the event type is `error`.
  String? errorMessage,

  /// An ID unique to the calling function's context so that events can get
  /// routed back to the correct tts.speak call.
  double? srcId,

  /// True if this is the final event that will be sent to this handler.
  bool? isFinalEvent,

  /// The length of the next part of the utterance. For example, in a `word`
  /// event, this is the length of the word which will be spoken next. It will
  /// be set to -1 if not set by the speech engine.
  int? length,
}) : _wrapped = $js.TtsEvent(
        type: type.toJS,
        charIndex: charIndex,
        errorMessage: errorMessage,
        srcId: srcId,
        isFinalEvent: isFinalEvent,
        length: length,
      );