cybex-dev / twilio_voice

Flutter Twilio Voice Plugin
https://twilio-voice-web.web.app/
MIT License
39 stars 79 forks source link

Invalid argument(s): DEVICETOKEN is not a valid CallState. #241

Open jd-bus opened 1 month ago

jd-bus commented 1 month ago

Issue Summary

Fatal Exception: FlutterError
Invalid argument(s): DEVICETOKEN is not a valid CallState.
0
twilio_voice_method_channel.dart - Line 430
MethodChannelTwilioVoice.parseCallEvent + 430
1
twilio_voice_method_channel.dart - Line 32
MethodChannelTwilioVoice.callEventsListener.<fn> + 32

Steps to Reproduce

Looking at the source, apparently this implies that the String "DEVICETOKEN" was passed as the parameter to parseCallEvent. parseCallEvent seems to handle a String starting with "DEVICETOKEN|" but does not handle just the String DEVICETOKEN:

  @override
  CallEvent parseCallEvent(String state) {
    if (state.startsWith("DEVICETOKEN|")) {
      var token = state.split('|')[1];
      if (deviceTokenChanged != null) {
        deviceTokenChanged!(token);
      }
      return CallEvent.log;
    } else ....

Maybe a simple fix? But I'm not sure of the root cause or why this would be unexpected. Maybe it means that the device token became null?