1 year ago

#72995

test-img

Xavi Font

WebRTC code translation from JS to Dart seems impossible

I was told that Dart would be easy to pick up for me, a JS dev. However, I have this code and cannot translate it to dart no matter how hard I try... any help?

I am using this library https://pub.dev/packages/flutter_webrtc

Here is the JS:

const localConnection = new RTCPeerConnection()
 

localConnection.onicecandidate = e =>  {
console.log(" NEW ice candidnat!! on localconnection reprinting SDP " )
 console.log(JSON.stringify(localConnection.localDescription))
}


const sendChannel = localConnection.createDataChannel("sendChannel");
 sendChannel.onmessage =e =>  console.log("messsage received!!!"  + e.data )
   sendChannel.onopen = e => console.log("open!!!!");
     sendChannel.onclose =e => console.log("closed!!!!!!");


localConnection.createOffer().then(o => localConnection.setLocalDescription(o) )

If you need any more info, lmk.

flutter

dart

webrtc

0 Answers

Your Answer

Accepted video resources