create method channel after upgrading flutter- can not resolve method getFlutterView()
Replace getFlutterView()
with getFlutterEngine().getDartExecutor().getBinaryMessenger()
.
You don't actually need the .getBinaryMessenger()
as DartExecutor
implements BinaryMessenger
itself (by just forwarding), but I think it's more correct to specify the messenger.
Simply add this method to your class:
BinaryMessenger getFlutterView(){
return getFlutterEngine().getDartExecutor().getBinaryMessenger();
}
And then optionally replace all ( Refactor > Rename ) "getFlutterView" to "getBinaryMessenger" to have a more readable code:
BinaryMessenger getBinaryMessenger(){
return getFlutterEngine().getDartExecutor().getBinaryMessenger();
}
Remove this import io.flutter.embedding.android.FlutterActivity;
Add this import io.flutter.app.FlutterActivity;
Worked for Me