flutter-webrtc / dart-sip-ua

A dart-lang version of the SIP UA stack.
MIT License
338 stars 262 forks source link

Fatal Exception: FlutterError Invalid argument: Instance of 'EventManager' #492

Open victortive opened 2 hours ago

victortive commented 2 hours ago

Describe the bug Looking through Crashlytics I'm seeing a common issue occur in the application. I followed the example of accepting a video call upgrade. Hoping that the stack track is enough to debug the issue.

@override
  void onNewReinvite(ReInvite event) {
    if (event.accept == null) return;
    if (event.reject == null) return;
    if (!voiceOnly || !(event.hasVideo ?? false)) {
      event.accept!.call({});
      return;
    }

    showAdaptiveDialog<void>(
      context: context,
      barrierDismissible: false,
      builder: (BuildContext context) {
        return AlertDialog(
          title: const Text('Upgrade to video?'),
          content: Text('$remoteIdentity is inviting you to video call'),
          alignment: Alignment.center,
          actionsAlignment: MainAxisAlignment.spaceBetween,
          actions: <Widget>[
            TextButton(
              child: const Text('Cancel'),
              onPressed: () {
                event.reject!.call({'status_code': 607});
                Navigator.of(context).pop();
              },
            ),
            TextButton(
              child: const Text('OK'),
              onPressed: () {
                event.accept!.call({});
                setState(() {
                  call.voiceOnly = false;
                });
                Navigator.of(context).pop();
              },
            ),
          ],
        );
      },
    );
  }
Fatal Exception: FlutterError
0  ???                            0x0 StandardMessageCodec.writeValue + 464 (message_codecs.dart:464)
1  ???                            0x0 StandardMessageCodec.writeValue.<fn> + 461 (message_codecs.dart:461)
2  ???                            0x0 _LinkedHashMapMixin.forEach (dart:collection)
3  ???                            0x0 StandardMessageCodec.writeValue + 459 (message_codecs.dart:459)
4  ???                            0x0 StandardMessageCodec.writeValue.<fn> + 461 (message_codecs.dart:461)
5  ???                            0x0 _LinkedHashMapMixin.forEach (dart:collection)
6  ???                            0x0 StandardMessageCodec.writeValue + 459 (message_codecs.dart:459)
7  ???                            0x0 StandardMethodCodec.encodeMethodCall + 599 (message_codecs.dart:599)
8  ???                            0x0 MethodChannel._invokeMethod + 323 (platform_channel.dart:323)
9  ???                            0x0 MethodChannel.invokeMethod + 507 (platform_channel.dart:507)
10 ???                            0x0 WebRTC.invokeMethod + 29 (utils.dart:29)
11 ???                            0x0 RTCPeerConnectionNative.createOffer + 328 (rtc_peerconnection_impl.dart:328)
12 ???                            0x0 RTCSession._createLocalDescription + 1684 (rtc_session.dart:1684)
13 ???                            0x0 RTCSession._sendReinvite + 2685 (rtc_session.dart:2685)

To Reproduce Steps to reproduce the behavior: Unknown.

Expected behavior A clear and concise description of what you expected to happen.

System Infomation() Flutter SDK Version: 3.24.3 Target OS and Version: iOS 18.0.1 Host OS and Version: macOS 15.0.1 24A348 darwin-x64

victortive commented 2 hours ago

@mikaelwills Do you think you have an idea about this issue since your wrote the PR?