StreamAudioRecorderController class
A controller for recording audio tracks. It provides methods to start, stop, cancel and finish the recording session.
This controller uses the AudioRecorder
to record audio tracks. It listens
to the recorder state changes and updates the AudioRecorderState
accordingly.
- Inheritance
-
- Object
- ChangeNotifier
- ValueNotifier<
AudioRecorderState> - StreamAudioRecorderController
Constructors
- StreamAudioRecorderController.new({RecordConfig? config, Duration amplitudeInterval = const Duration(milliseconds: 100)})
-
A controller for recording audio tracks. It provides methods to start,
stop, cancel and finish the recording session.
factory
- StreamAudioRecorderController.raw({required RecordConfig config, required AudioRecorder recorder, AudioRecorderState initialState = const RecordStateIdle(), Duration amplitudeInterval = const Duration(milliseconds: 100)})
- A controller for recording audio tracks. It provides methods to start, stop, cancel and finish the recording session.
Properties
- config → RecordConfig
-
The configuration for the recording session.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value ↔ AudioRecorderState
-
The current value stored in this notifier.
getter/setter pairinherited
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
cancelRecord(
{bool discardTrack = true}) → Future< void> - Cancels the current recording session and discards the recorded track.
-
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
override
-
dragRecord(
Offset dragOffset) → void - Updates the drag offset of the recording session.
-
finishRecord(
{String? name}) → Future< Attachment?> - Similar to stopRecord but does not update any state. Returns the recorded audio track as an attachment.
-
lockRecord(
) → void - Updates the current recording session in the locked state, no longer requiring the user to hold the button.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
showInfo(
String message, {Duration duration = const Duration(seconds: 3)}) → void -
Shows an info message to the user for the given
duration
. -
startRecord(
) → Future< void> - Starts a new recording session.
-
stopRecord(
{String? name}) → Future< void> - Stops the current recording session and returns the recorded audio track.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited