*[<Null safety>](https://dart.dev/null-safety)*
Future<void> connect ({bool hitTestable = true, bool focusable = true, dynamic viewOcclusionHint = Rect.zero})
Future<void> connect({ bool hitTestable = true, bool focusable = true, Rect viewOcclusionHint = Rect.zero, }) async { if (_viewCreated) return; _viewCreated = true; // Only allow this to be called once // Setup callbacks for receiving view events. FuchsiaViewsService.instance.register(viewId, (call) async { switch (call.method) { case 'View.viewConnected': _whenConnected.complete(); onViewConnected?.call(this); break; case 'View.viewDisconnected': _whenConnected = Completer(); onViewDisconnected?.call(this); break; case 'View.viewStateChanged': final callArgs = call.arguments as Map; final state = callArgs['state'] == 1 || callArgs['state'] == true; onViewStateChanged?.call(this, state); break; default: print('Unknown method call from platform view channel: $call'); } }); // Now send a create message to the platform view. return FuchsiaViewsService.instance.createView( viewId, hitTestable: hitTestable, focusable: focusable, viewOcclusionHint: viewOcclusionHint, ); }