SoundConfiguration class abstract

Configuration for chatbot sound effects.

Controls which sounds are played during chat interactions and their volume level.

Example:

final soundConfig = SoundConfiguration(
  enabled: true,
  volume: 0.7,
  messageSent: true,
  messageReceived: true,
);
Available extensions
Annotations
  • @freezed

Constructors

SoundConfiguration({@Default.new(true) bool enabled, @Default.new(0.5) double volume, @Default.new(true) bool messageSent, @Default.new(true) bool messageReceived, @Default.new(false) bool chatOpened, @Default.new(false) bool chatClosed, @Default.new(true) bool error, @Default.new(false) bool buttonClick, @Default.new(true) bool notification, String? messageSentSoundUrl, String? messageReceivedSoundUrl, String? notificationSoundUrl, String? errorSoundUrl})
const
factory
SoundConfiguration.fromJson(Map<String, dynamic> json)
factory

Properties

buttonClick bool
Play sound when clicking buttons in rich content.
no setterinherited
chatClosed bool
Play sound when chat widget closes.
no setterinherited
chatOpened bool
Play sound when chat widget opens.
no setterinherited
copyWith → $SoundConfigurationCopyWith<SoundConfiguration>
Create a copy of SoundConfiguration with the given fields replaced by the non-null parameter values.
no setterinherited
enabled bool
Master switch for all sounds. When false, no sounds play.
no setterinherited
error bool
Play sound when an error occurs.
no setterinherited
errorSoundUrl String?
Custom URL for error sound (uses default if null).
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
messageReceived bool
Play sound when bot responds with a message.
no setterinherited
messageReceivedSoundUrl String?
Custom URL for message received sound (uses default if null).
no setterinherited
messageSent bool
Play sound when user sends a message.
no setterinherited
messageSentSoundUrl String?
Custom URL for message sent sound (uses default if null).
no setterinherited
notification bool
Play notification sound when message received and chat is minimized.
no setterinherited
notificationSoundUrl String?
Custom URL for notification sound (uses default if null).
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
volume double
Volume level from 0.0 (silent) to 1.0 (full volume).
no setterinherited

Methods

map<TResult extends Object?>(TResult $default(_SoundConfiguration value)) → TResult

Available on SoundConfiguration, provided by the SoundConfigurationPatterns extension

A switch-like method, using callbacks.
mapOrNull<TResult extends Object?>(TResult? $default(_SoundConfiguration value)?) → TResult?

Available on SoundConfiguration, provided by the SoundConfigurationPatterns extension

A variant of map that fallback to returning null.
maybeMap<TResult extends Object?>(TResult $default(_SoundConfiguration value)?, {required TResult orElse()}) → TResult

Available on SoundConfiguration, provided by the SoundConfigurationPatterns extension

A variant of map that fallback to returning orElse.
maybeWhen<TResult extends Object?>(TResult $default(bool enabled, double volume, bool messageSent, bool messageReceived, bool chatOpened, bool chatClosed, bool error, bool buttonClick, bool notification, String? messageSentSoundUrl, String? messageReceivedSoundUrl, String? notificationSoundUrl, String? errorSoundUrl)?, {required TResult orElse()}) → TResult

Available on SoundConfiguration, provided by the SoundConfigurationPatterns extension

A variant of when that fallback to an orElse callback.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Serializes this SoundConfiguration to a JSON map.
inherited
toString() String
A string representation of this object.
inherited
when<TResult extends Object?>(TResult $default(bool enabled, double volume, bool messageSent, bool messageReceived, bool chatOpened, bool chatClosed, bool error, bool buttonClick, bool notification, String? messageSentSoundUrl, String? messageReceivedSoundUrl, String? notificationSoundUrl, String? errorSoundUrl)) → TResult

Available on SoundConfiguration, provided by the SoundConfigurationPatterns extension

A switch-like method, using callbacks.
whenOrNull<TResult extends Object?>(TResult? $default(bool enabled, double volume, bool messageSent, bool messageReceived, bool chatOpened, bool chatClosed, bool error, bool buttonClick, bool notification, String? messageSentSoundUrl, String? messageReceivedSoundUrl, String? notificationSoundUrl, String? errorSoundUrl)?) → TResult?

Available on SoundConfiguration, provided by the SoundConfigurationPatterns extension

A variant of when that fallback to returning null

Operators

operator ==(Object other) bool
The equality operator.
inherited