I'm trying to follow the Flutter tutorial: https://flutter.dev/docs/development/platform-integration/platform-views, but the Java code has errors and doesn't compile. Specifically, NativeViewFactory is defined as having two parameters, but then is called with no parameters. What changes can be made to the code so that it compiles and displays a native Android view in Flutter?
In NativeViewFactory.java:
@NonNull private final BinaryMessenger messenger;
@NonNull private final View containerView;
NativeViewFactory(@NonNull BinaryMessenger messenger, @NonNull View containerView) {
super(StandardMessageCodec.INSTANCE);
this.messenger = messenger;
this.containerView = containerView;
}
In MainActivity.java:
public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
flutterEngine
.getPlatformViewsController()
.getRegistry()
.registerViewFactory("<platform-view-type>", new NativeViewFactory());
}