I'm facing issue after integrating flutter module into a native ios app. After closing the flutter module either by using SystemNavigator.pop(animated:true), when trying to open it again from native ios app, the flutter module lands on the recently closed screen. I have even tried by invoking a method from flutter module and closed the flutterViewController from native ios app, which again closes the app but opens the same screen that was exited before. Also, destroying the flutterEngine also didnt work.
Could anyone please share your knowledge regarding this. It will be really helpful.
FlutterEngine *flutterEngine = ((AppDelegate *)UIApplication.sharedApplication.delegate).flutterEngine;
FlutterViewController *flutterViewController = [[FlutterViewController alloc] initWithEngine:flutterEngine nibName:nil bundle:nil];
FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:@"com.sara.app/myAppChannel" binaryMessenger:flutterViewController.binaryMessenger];
//exitUpiModule triggered from flutter module
[channel setMethodCallHandler:^(FlutterMethodCall * _Nonnull call, FlutterResult _Nonnull result) {
if([call.method isEqualToString:@"exitUpiModule"]){
//CLOSES THE FLUTTER MODULE BUT WHEN OPENED IT LANDS ON THE SAME SCREEN
[flutterViewController dismissViewControllerAnimated:YES completion:nil];
}
}];
Tried dismissing the flutterViewController, detroyContext but didnt work.