*<Null safety>*
Future<void> connect ({bool hitTestable: true, bool focusable: true})
Future<void> connect({bool hitTestable = true, bool focusable = true}) async { if (_connected) return; // Setup callbacks for receiving view events. platformViewChannel.setMethodCallHandler((call) async { switch (call.method) { case 'View.viewConnected': _connected = true; onViewConnected?.call(this); break; case 'View.viewDisconnected': _connected = false; onViewDisconnected?.call(this); break; case 'View.viewStateChanged': onViewStateChanged?.call(this, call.arguments.state); break; default: print('Unknown method call from platform view channel: $call'); } }); // Now send a create message to the platform view. final Map<String, dynamic> args = <String, dynamic>{ 'viewId': viewId, 'hitTestable': hitTestable, 'focusable': focusable, }; return platformViewChannel.invokeMethod('View.create', args); }