-
Notifications
You must be signed in to change notification settings - Fork 388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unhandled Exception: LateInitializationError: Field 'requestPort' has not been initialized. Agora flutter #860
Comments
same here |
@FaizanAhmad127 |
Having the same issue here. It's working fine after one call, this exception is throwing only on the first initialization for me.
|
|
I think the method |
Solved.
and used get it package to achieve a singleton pattern which is also suggested by Agora while creating RTCEngine so we can have only one instance of it. And then register the service class at the very beginning of main() like this:
Then I used the engine variable inside my video call screen,like this
and the rest of the code remains the same. |
You should call the class VideoCallPageState extends State<VideoCallPage> {
late RtcEngine _engine;
bool _isInitialized = false;
@override
void initState() {
super.initState();
// initialize agora sdk
initialize();
}
Future<void> initialize() async {
_engine = createAgoraRtcEngine();
await _engine.initialize(RtcEngineContext(
appId: 'your_app_id',
logConfig: LogConfig(level: LogLevel.logLevelError)));
setState((){
_isInitialized = true;
});
}
@override
Widget build(BuildContext context) {
if (!_isInitialized) {
return Container();
}
// Only show AgoraVideoView after initialized
...
}
} |
Thanks, yes I know that and I was doing the exact same thing but it led me to a response port error in my large-scale project. I'm doing the same now but in a service class that is run before other service classes. If I run your code after other services it gives me an error, which means I have to create and initialize the engine before everything else in my app. |
This can be enhanced, but you should control the initializing order on your own at this time. |
Yes, I have done that. But any luck on finding why we get responsePort error? |
Since the |
i'm facing the same problem. if you can fix, let me know. thanks man |
@littleGnAl iam getting the same error and the same steps to reproduce it. If initialization is the case, then it should give the error in the first call also. |
Please same here, after upgrading my Flutter today, |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please raise a new issue. |
I am working on a large-scale project and integrating video calls into it. So I made a separate project just for practice and I achieved good results. The group calling worked perfectly on both android and IOS. But then I integrated the same code in my large-scale project which uses firebase as a backend and when I navigate to the video screen it gives me an error saying "Unhandled Exception: LateInitializationError: Field 'requestPort' has not been initialized". The Agora console is on Testing for now and the channel wasn't expired just in case you guys are wondering. As I said it works perfectly in a separate project.
The app uses agora_rtc_engine: ^6.1.0 and defined in pubspec.yaml file
The text was updated successfully, but these errors were encountered: