MicStream class

Constructors

MicStream()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

bitDepth Future<int>
The actual bit depth used for streaming. Only completes once a stream started.
no setter
bufferSize Future<int>
The amount of recorded data, per sample, in bytes. Only completes once a stream started.
no setter
permissionStatus Future<bool>
This function manages the permission and ensures you're allowed to record audio
no setter
sampleRate Future<int>
The actual sample rate used for streaming. Only completes once a stream started.
no setter
toSampleStream StreamTransformer<Uint8List, dynamic>
StreamTransformer to convert a raw Stream
no setter

Static Methods

microphone({AudioSource? audioSource, int? sampleRate, ChannelConfig? channelConfig, AudioFormat? audioFormat}) Stream<Uint8List>
This function initializes a connection to the native backend (if not already available). Returns a Uint8List stream representing the captured audio. IMPORTANT - on iOS, there is no guarantee that captured audio will be encoded with the requested sampleRate/bitDepth. You must check the sampleRate and bitDepth properties of the MicStream object after invoking this method (though this does not need to be before listening to the returned stream). This is why this method returns a Uint8List - if you request a deeper encoding, you will need to manually convert the returned stream to the appropriate type, e.g., for 16 bit map each element using uint8List.buffer.asUint16List(). Alternatively, you can call toSampleStream(Stream<Uint8List>) to transform the raw stream to a more easily usable stream.
shouldRequestPermission(bool requestPermission) bool
Updates flag to determine whether to request audio recording permission. Set to false to disable dialogue, set to true (default) to request permission if necessary