title: Pass data from flutter to native IOS
body: <p>How to pass data from flutter to native iOS (Swift) by using platform specific code. I searched in the internet and stack overflow but it is showing an example of only Native Android. Below is the code till now what i have tried</p>
  <blockquote>
  <p>Dart code</p>
  </blockquote>
  <pre><code>static const methodChannel = MethodChannel('com.ios');
  void openPaymentMethod() async {
          String? result = await methodChannel
              .invokeMethod&lt;String&gt;('isSetUpAvailable', {'text': hello});
          if (result != null) {
            print(result);
          }
        }
  </code></pre>
  <blockquote>
  <p>Native Swift code</p>
  </blockquote>
  <pre><code>  let METHOD_CHANNEL_NAME = &quot;com.ios&quot;
    let controller: FlutterViewController = window?.rootViewController as! FlutterViewController
    let methodChannel = FlutterMethodChannel(name: METHOD_CHANNEL_NAME, binaryMessenger: controller.binaryMessenger)
    methodChannel.setMethodCallHandler({
        (call:FlutterMethodCall,result: @escaping FlutterResult) -&gt; Void in
        switch call.method{
        case &quot;isSetUpAvailable&quot;:
            result(&quot;Success&quot;)
        default:
            result(FlutterMethodNotImplemented)
        }
    })
  </code></pre>