init method
void
init()
Initializes listeners for the underlying BLoC.
This method should be called before performing any SIP actions.
Implementation
void init() {
_bloc.stream.listen((state) {
if (state is SipControllerLoaded) {
currentCall.value = state.currentCall;
callDuration.value = _formatDuration(state.callDuration);
sipData.value = state.sipConfig;
localStream.value = state.localStream;
remoteStream.value = state.remoteStream;
callState.value = state.callState;
sipStarted.value = state.sipStarted;
} else {
// Reset state when not loaded
currentCall.value = null;
callDuration.value = '00:00';
localStream.value = null;
remoteStream.value = null;
callState.value = 0;
sipStarted.value = false;
}
});
}