I am implementing video call using the twilio_programmable_video package in my flutter app. I have managed to manually create a access token via Twilio's console and hardcoded it to the app and i am able to join/create a room on flutter web. However, shortly after joining the room, i get this error:
Below is my codes. I have not implemented the localtracks to show the screen view yet:
late Room _room;
final Completer<Room> _completer = Completer<Room>();
Future<Room> connectToRoom() async {
await TwilioProgrammableVideo.debug(dart: true, native: true);
// // Create an audio track.
// var localAudioTrack = LocalAudioTrack(true, 'local_audio');
//
// // Retrieve the camera source of your choosing
// var cameraSources = await CameraSource.getSources();
// var cameraCapturer = CameraCapturer(
// cameraSources.firstWhere((source) => source.isFrontFacing),
// );
//
// // Create a video track.
// var localVideoTrack = LocalVideoTrack(true, cameraCapturer);
//
// // Getting the local video track widget.
// // This can only be called after the TwilioProgrammableVideo.connect() is called.
// var widget = localVideoTrack.widget();
final connectOptions = ConnectOptions(
accessToken,
roomName: roomName,
// audioTracks: [LocalAudioTrack(true ],
// videoTracks: localTracks,
);
_room = await TwilioProgrammableVideo.connect(connectOptions);
_room.onConnected.listen((room){
print('Connected to ${room.name}');
_completer.complete(_room);
});
_room.onConnectFailure.listen((event){
print('Failed to connect to room ${event.room.name} with exception: ${event.exception}');
_completer.completeError(event.exception as Object);
});
return _completer.future;
}
It appears that the dependency package 'enum_to_string-2.0.1' is causing an error. There's this function in enum_to_string.dart that is handling null. Follow changes fixed it.
##CHANGE FROM##
##CHANGE TO##