{"id":361017,"date":"2024-05-21T01:04:46","date_gmt":"2024-05-21T01:04:46","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=361017"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=361017","title":{"rendered":"<span>\u041a\u0430\u043a \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c Flutter \u0432 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 iOS \u0438 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0430 Codemagic (\u0427\u0430\u0441\u0442\u044c 2)<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>Hola, Amigos! \u041d\u0430 \u0441\u0432\u044f\u0437\u0438 \u0421\u0430\u0448\u0430 \u0427\u0430\u043f\u043b\u044b\u0433\u0438\u043d, Flutter dev \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0437\u0430\u043a\u0430\u0437\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 Amiga. \u041d\u0430\u0448\u0435\u043b \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0443\u044e <a href=\"https:\/\/medium.com\/@codemagicio\/how-to-add-flutter-modules-to-native-ios-project-and-test-it-on-codemagic-ae3c09de7a3b\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u044e<\/a> \u043d\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u043c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c Flutter \u0432 \u043d\u043e\u0432\u044b\u0439 \u0438\u043b\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 Native iOS. \u0420\u0435\u0448\u0438\u043b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441 \u0432\u0430\u043c\u0438 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c. \u042d\u0442\u043e \u0432\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0434\u0442\u0438 \u0440\u0435\u0447\u044c \u043f\u0440\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u044d\u043a\u0440\u0430\u043d\u0430 Flutter \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f iOS \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 platform channel.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c77\/5b8\/6d9\/c775b86d925d91c75f11c49bb7e12bf9.png\" width=\"1280\" height=\"720\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c77\/5b8\/6d9\/c775b86d925d91c75f11c49bb7e12bf9.png\"\/><\/figure>\n<p>\u041f\u0435\u0440\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c <a href=\"https:\/\/habr.com\/ru\/articles\/775298\/\" rel=\"noopener noreferrer nofollow\"><u>\u0437\u0434\u0435\u0441\u044c<\/u><\/a>. \u041e\u043d\u0430 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 iOS \u0438 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 Flutter \u0432 \u044d\u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u00a0<\/p>\n<p>\u0422\u0440\u0435\u0442\u044c\u044f \u0447\u0430\u0441\u0442\u044c \u0432\u044b\u0439\u0434\u0435\u0442 \u0441\u043e\u0432\u0441\u0435\u043c \u0441\u043a\u043e\u0440\u043e. \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c, \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0439\u0442\u0435\u0441\u044c \u043d\u0430 \u043d\u0430\u0448 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c-\u043a\u0430\u043d\u0430\u043b <a href=\"https:\/\/t.me\/+YDX3yq4hGLY2NGMy\" rel=\"noopener noreferrer nofollow\"><u>Flutter. \u041c\u043d\u043e\u0433\u043e<\/u><\/a>. \u0422\u0430\u043c \u043c\u044b \u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u0434\u0435\u043b\u0438\u043c\u0441\u044f \u043e\u043f\u044b\u0442\u043e\u043c, \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c\u0438 \u043c\u0435\u0440\u043e\u043f\u0440\u0438\u044f\u0442\u0438\u044f\u043c\u0438 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0438 \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439. \u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u00abHot Reload\u00bb, \u00abHot Restart\u00bb \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 Codemagic.<\/p>\n<p>\u041f\u043e\u0435\u0445\u0430\u043b\u0438!<\/p>\n<h2>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u044d\u043a\u0440\u0430\u043d\u0430 Flutter \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 iOS<\/h2>\n<p>FlutterViewController \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u044d\u043a\u0440\u0430\u043d\u0430 Flutter \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f iOS. \u041d\u043e \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0442\u044c FlutterEngine.<\/p>\n<p>\u041f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0435 \u043c\u0435\u0441\u0442\u043e \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f FlutterEngine \u2014 \u0432\u043d\u0443\u0442\u0440\u0438 <code>AppDelegate.swift<\/code>.<\/p>\n<p>\u0417\u0430\u043c\u0435\u043d\u044f\u0435\u043c \u0432\u0441\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u044d\u0442\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043a\u043e\u0434\u043e\u043c:<\/p>\n<pre><code>\/\/ AppDelegate.swift import UIKit import Flutter import FlutterPluginRegistrant @UIApplicationMain class AppDelegate: FlutterAppDelegate {          var flutterEngine : FlutterEngine?;          override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {         self.flutterEngine = FlutterEngine(name: \"io.flutter\", project: nil);         self.flutterEngine?.run(withEntrypoint: nil);         GeneratedPluginRegistrant.register(with: self.flutterEngine!);         return super.application(application, didFinishLaunchingWithOptions: launchOptions);     } }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u0444\u0430\u0439\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 ViewController.swift, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u044d\u043a\u0440\u0430\u043d \u043d\u0430 Flutter:<\/p>\n<pre><code>\/\/ ViewController.swift \/\/ ... import Flutter class ViewController: UIViewController {          \/\/ ...          @IBAction func calculatePressed(_ sender: UIButton) {         \/\/ ...         let flutterEngine = ((UIApplication.shared.delegate as? AppDelegate)?.flutterEngine)!;         let flutterViewController = FlutterViewController(engine: flutterEngine, nibName: nil, bundle: nil);         self.present(flutterViewController, animated: true, completion: nil)     } }<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u0435\u0439\u0447\u0430\u0441, \u0442\u043e \u0441\u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u044d\u043a\u0440\u0430\u043d \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Flutter Demo Counter, \u043d\u0430\u0436\u0430\u0432 \u043a\u043d\u043e\u043f\u043a\u0443 \u00abCALCULATE\u00bb .<\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044c \u043a <a href=\"https:\/\/docs.flutter.dev\/add-to-app\/ios\/add-flutter-screen?tab=vc-swift-tab\" rel=\"noopener noreferrer nofollow\"><u>\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Flutter<\/u><\/a> \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438.<\/p>\n<h2>\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 Flutter<\/h2>\n<p>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u044d\u043a\u0440\u0430\u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0418\u041c\u0422 \u0431\u0443\u0434\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0438 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0432\u0441\u0435\u0433\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0432\u0438\u0434\u0436\u0435\u0442\u043e\u0432.<\/p>\n<p>\u041a\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u044d\u043a\u0440\u0430\u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0418\u041c\u0422:<\/p>\n<pre><code>\/\/ main.dart import 'dart:convert'; import 'package:flutter\/material.dart'; import 'package:flutter\/services.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget {   @override   Widget build(BuildContext context) {     return MaterialApp(       title: 'BMI Calculator Module',       theme: ThemeData(         primarySwatch: Colors.blue,       ),       home: MyHomePage(),       debugShowCheckedModeBanner: false,     );   } } class MyHomePage extends StatefulWidget {   @override   _MyHomePageState createState() => _MyHomePageState(); } class _MyHomePageState extends State&lt;MyHomePage> {   Future&lt;void> _receiveFromHost(MethodCall call) async {     \/\/ To be implemented.     \/\/ Will be used for retrieving data passed from     \/\/ the native iOS app.   }   @override   Widget build(BuildContext context) {     return Scaffold(       body: Container(         color: Colors.blue,         child: Center(           child: Column(             mainAxisSize: MainAxisSize.max,             mainAxisAlignment: MainAxisAlignment.center,             crossAxisAlignment: CrossAxisAlignment.center,             children: &lt;Widget>[               Text(                 'YOUR BMI',                 style: TextStyle(                     color: Colors.white,                     fontSize: 40,                     fontWeight: FontWeight.bold),               ),               Text(                 '23.7',                 style: TextStyle(                     color: Colors.white,                     fontSize: 70,                     fontWeight: FontWeight.bold),               ),               Text(                 'Fit as a fiddle!',                 style: TextStyle(                   color: Colors.white,                   fontSize: 20,                 ),               ),             ],           ),         ),       ),     );   } }<\/code><\/pre>\n<h2>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Platform Channel<\/h2>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c Platform Channel \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f iOS \u0432 \u043c\u043e\u0434\u0443\u043b\u044c Flutter.<\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043c\u043e\u0434\u0443\u043b\u044f Flutter (\u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445)<\/h3>\n<ol>\n<li>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e, \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u0430\u043d\u0430\u043b \u0441 \u043a\u0430\u043a\u0438\u043c-\u043d\u0438\u0431\u0443\u0434\u044c \u0438\u043c\u0435\u043d\u0435\u043c \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 <code>_MyHomePageState<\/code>.<\/p>\n<\/li>\n<\/ol>\n<pre><code>\/\/ main.dart static const platform = const MethodChannel('com.souvikbiswas.bmi\/data');<\/code><\/pre>\n<ol start=\"2\">\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043c\u0435\u0442\u043e\u0434 <code>_receiveFromHost()<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438, \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u043c\u043e\u0434\u0443\u043b\u044f Flutter.<\/p>\n<\/li>\n<\/ol>\n<pre><code>\/\/ main.dart Future&lt;void> _receiveFromHost(MethodCall call) async {    var jData;      try {      print(call.method);        if (call.method == \"fromHostToClient\") {        final String data = call.arguments;        print(call.arguments);        jData = await jsonDecode(data);      }    } on PlatformException catch (error) {      print(error);    }      setState(() {      jData1 = jData;      if (jData['color'] == 'blue') {        color = Colors.blue;      } else if (jData['color'] == 'green') {        color = Colors.green;      } else {        color = Colors.pink;      }    });  }<\/code><\/pre>\n<ol start=\"3\">\n<li>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c <code>_receiveFromHost()<\/code>\u043c\u0435\u0442\u043e\u0434 \u043a\u0430\u043a \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 <code>setMethodCallHandler<\/code>.<\/p>\n<\/li>\n<\/ol>\n<pre><code>\/\/ main.dart _MyHomePageState() {      platform.setMethodCallHandler(_receiveFromHost); }<\/code><\/pre>\n<ol start=\"4\">\n<li>\n<p>\u041f\u0438\u0448\u0435\u043c \u043a\u043e\u0434 \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u0430 build, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Platform Channel:<\/p>\n<\/li>\n<\/ol>\n<pre><code>\/\/ main.dart  @override   Widget build(BuildContext context) {     return Scaffold(       body: Container(         color: color, \/\/ Updated         child: Center(           child: Column(             \/\/ ...             children: &lt;Widget>[               Text(                 'YOUR BMI',                 \/\/ ...               ),               Text(                 jData1['value'], \/\/ Updated                 \/\/ ...               ),               Text(                 jData1['advice'], \/\/ Updated                 \/\/ ...               ),             ],           ),         ),       ),     );   } }<\/code><\/pre>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f iOS (\u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445)<\/h3>\n<ol>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u0430\u043d\u0430\u043b \u0434\u043b\u044f \u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0441 \u043c\u043e\u0434\u0443\u043b\u0435\u043c Flutter<\/p>\n<\/li>\n<\/ol>\n<pre><code>\/\/ Define inside calculatePressed() method let bmiDataChannel = FlutterMethodChannel(name: \"com.souvikbiswas.bmi\/data\", binaryMessenger: flutterViewController.binaryMessenger)<\/code><\/pre>\n<ol start=\"2\">\n<li>\n<p>\u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u043a\u0430\u043d\u0430\u043b\u0443<\/p>\n<\/li>\n<\/ol>\n<pre><code>\/\/ Define inside calculatePressed() method  let bmiDataChannel = FlutterMethodChannel(name: \"com.souvikbiswas.bmi\/data\", binaryMessenger: flutterViewController.binaryMessenger)        let jsonObject: NSMutableDictionary = NSMutableDictionary()  jsonObject.setValue(bmiValue, forKey: \"value\")  jsonObject.setValue(bmiAdvice, forKey: \"advice\")  jsonObject.setValue(bmiColor, forKey: \"color\")    var convertedString: String? = nil    do {      let data1 =  try JSONSerialization.data(withJSONObject: jsonObject, options: JSONSerialization.WritingOptions.prettyPrinted)      convertedString = String(data: data1, encoding: String.Encoding.utf8)  } catch let myJSONError {      print(myJSONError)  }        bmiDataChannel.invokeMethod(\"fromHostToClient\", arguments: convertedString)<\/code><\/pre>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u0432\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e\u0434\u043e\u0448\u043b\u0430 \u043a \u043a\u043e\u043d\u0446\u0443. \u041c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u044d\u043a\u0440\u0430\u043d\u0430 Flutter \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f iOS \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 platform channel. \u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u0440\u0435\u0447\u044c \u0431\u0443\u0434\u0435\u0442 \u0438\u0434\u0442\u0438 \u043f\u0440\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u00abHot Reload\u00bb, \u00abHot Restart\u00bb \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 Codemagic.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0430\u043d\u043e\u043d\u0441, \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0439\u0442\u0435\u0441\u044c \u043d\u0430 \u043d\u0430\u0448 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c-\u043a\u0430\u043d\u0430\u043b <a href=\"https:\/\/t.me\/+YDX3yq4hGLY2NGMy\" rel=\"noopener noreferrer nofollow\"><u>Flutter. \u041c\u043d\u043e\u0433\u043e<\/u><\/a>!<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u043b\u0438 1 \u0447\u0430\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u0438, \u0442\u043e \u043e\u043d\u0430 <a href=\"https:\/\/habr.com\/ru\/articles\/775298\/\" rel=\"noopener noreferrer nofollow\"><u>\u0437\u0434\u0435\u0441\u044c<\/u><\/a>.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/775928\/\"> https:\/\/habr.com\/ru\/articles\/775928\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>Hola, Amigos! \u041d\u0430 \u0441\u0432\u044f\u0437\u0438 \u0421\u0430\u0448\u0430 \u0427\u0430\u043f\u043b\u044b\u0433\u0438\u043d, Flutter dev \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0437\u0430\u043a\u0430\u0437\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 Amiga. \u041d\u0430\u0448\u0435\u043b \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0443\u044e <a href=\"https:\/\/medium.com\/@codemagicio\/how-to-add-flutter-modules-to-native-ios-project-and-test-it-on-codemagic-ae3c09de7a3b\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u044e<\/a> \u043d\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u043c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c Flutter \u0432 \u043d\u043e\u0432\u044b\u0439 \u0438\u043b\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 Native iOS. \u0420\u0435\u0448\u0438\u043b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441 \u0432\u0430\u043c\u0438 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c. \u042d\u0442\u043e \u0432\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0434\u0442\u0438 \u0440\u0435\u0447\u044c \u043f\u0440\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u044d\u043a\u0440\u0430\u043d\u0430 Flutter \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f iOS \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 platform channel.<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041f\u0435\u0440\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c <a href=\"https:\/\/habr.com\/ru\/articles\/775298\/\" rel=\"noopener noreferrer nofollow\"><u>\u0437\u0434\u0435\u0441\u044c<\/u><\/a>. \u041e\u043d\u0430 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 iOS \u0438 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 Flutter \u0432 \u044d\u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\u00a0<\/p>\n<p>\u0422\u0440\u0435\u0442\u044c\u044f \u0447\u0430\u0441\u0442\u044c \u0432\u044b\u0439\u0434\u0435\u0442 \u0441\u043e\u0432\u0441\u0435\u043c \u0441\u043a\u043e\u0440\u043e. \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c, \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0439\u0442\u0435\u0441\u044c \u043d\u0430 \u043d\u0430\u0448 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c-\u043a\u0430\u043d\u0430\u043b <a href=\"https:\/\/t.me\/+YDX3yq4hGLY2NGMy\" rel=\"noopener noreferrer nofollow\"><u>Flutter. \u041c\u043d\u043e\u0433\u043e<\/u><\/a>. \u0422\u0430\u043c \u043c\u044b \u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u0434\u0435\u043b\u0438\u043c\u0441\u044f \u043e\u043f\u044b\u0442\u043e\u043c, \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c\u0438 \u043c\u0435\u0440\u043e\u043f\u0440\u0438\u044f\u0442\u0438\u044f\u043c\u0438 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0438 \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439. \u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u00abHot Reload\u00bb, \u00abHot Restart\u00bb \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 Codemagic.<\/p>\n<p>\u041f\u043e\u0435\u0445\u0430\u043b\u0438!<\/p>\n<h2>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u044d\u043a\u0440\u0430\u043d\u0430 Flutter \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 iOS<\/h2>\n<p>FlutterViewController \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u044d\u043a\u0440\u0430\u043d\u0430 Flutter \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f iOS. \u041d\u043e \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0442\u044c FlutterEngine.<\/p>\n<p>\u041f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0435 \u043c\u0435\u0441\u0442\u043e \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f FlutterEngine \u2014 \u0432\u043d\u0443\u0442\u0440\u0438 <code>AppDelegate.swift<\/code>.<\/p>\n<p>\u0417\u0430\u043c\u0435\u043d\u044f\u0435\u043c \u0432\u0441\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u044d\u0442\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043a\u043e\u0434\u043e\u043c:<\/p>\n<pre><code>\/\/ AppDelegate.swift import UIKit import Flutter import FlutterPluginRegistrant @UIApplicationMain class AppDelegate: FlutterAppDelegate {          var flutterEngine : FlutterEngine?;          override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {         self.flutterEngine = FlutterEngine(name: \"io.flutter\", project: nil);         self.flutterEngine?.run(withEntrypoint: nil);         GeneratedPluginRegistrant.register(with: self.flutterEngine!);         return super.application(application, didFinishLaunchingWithOptions: launchOptions);     } }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u0444\u0430\u0439\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 ViewController.swift, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u044d\u043a\u0440\u0430\u043d \u043d\u0430 Flutter:<\/p>\n<pre><code>\/\/ ViewController.swift \/\/ ... import Flutter class ViewController: UIViewController {          \/\/ ...          @IBAction func calculatePressed(_ sender: UIButton) {         \/\/ ...         let flutterEngine = ((UIApplication.shared.delegate as? AppDelegate)?.flutterEngine)!;         let flutterViewController = FlutterViewController(engine: flutterEngine, nibName: nil, bundle: nil);         self.present(flutterViewController, animated: true, completion: nil)     } }<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u0435\u0439\u0447\u0430\u0441, \u0442\u043e \u0441\u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u044d\u043a\u0440\u0430\u043d \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Flutter Demo Counter, \u043d\u0430\u0436\u0430\u0432 \u043a\u043d\u043e\u043f\u043a\u0443 \u00abCALCULATE\u00bb .<\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044c \u043a <a href=\"https:\/\/docs.flutter.dev\/add-to-app\/ios\/add-flutter-screen?tab=vc-swift-tab\" rel=\"noopener noreferrer nofollow\"><u>\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Flutter<\/u><\/a> \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438.<\/p>\n<h2>\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 Flutter<\/h2>\n<p>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u044d\u043a\u0440\u0430\u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0418\u041c\u0422 \u0431\u0443\u0434\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0438 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0432\u0441\u0435\u0433\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0432\u0438\u0434\u0436\u0435\u0442\u043e\u0432.<\/p>\n<p>\u041a\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u044d\u043a\u0440\u0430\u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0418\u041c\u0422:<\/p>\n<pre><code>\/\/ main.dart import 'dart:convert'; import 'package:flutter\/material.dart'; import 'package:flutter\/services.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget {   @override   Widget build(BuildContext context) {     return MaterialApp(       title: 'BMI Calculator Module',       theme: ThemeData(         primarySwatch: Colors.blue,       ),       home: MyHomePage(),       debugShowCheckedModeBanner: false,     );   } } class MyHomePage extends StatefulWidget {   @override   _MyHomePageState createState() => _MyHomePageState(); } class _MyHomePageState extends State&lt;MyHomePage> {   Future&lt;void> _receiveFromHost(MethodCall call) async {     \/\/ To be implemented.     \/\/ Will be used for retrieving data passed from     \/\/ the native iOS app.   }   @override   Widget build(BuildContext context) {     return Scaffold(       body: Container(         color: Colors.blue,         child: Center(           child: Column(             mainAxisSize: MainAxisSize.max,             mainAxisAlignment: MainAxisAlignment.center,             crossAxisAlignment: CrossAxisAlignment.center,             children: &lt;Widget>[               Text(                 'YOUR BMI',                 style: TextStyle(                     color: Colors.white,                     fontSize: 40,                     fontWeight: FontWeight.bold),               ),               Text(                 '23.7',                 style: TextStyle(                     color: Colors.white,                     fontSize: 70,                     fontWeight: FontWeight.bold),               ),               Text(                 'Fit as a fiddle!',                 style: TextStyle(                   color: Colors.white,                   fontSize: 20,                 ),               ),             ],           ),         ),       ),     );   } }<\/code><\/pre>\n<h2>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Platform Channel<\/h2>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c Platform Channel \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f iOS \u0432 \u043c\u043e\u0434\u0443\u043b\u044c Flutter.<\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043c\u043e\u0434\u0443\u043b\u044f Flutter (\u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445)<\/h3>\n<ol>\n<li>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e, \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u0430\u043d\u0430\u043b \u0441 \u043a\u0430\u043a\u0438\u043c-\u043d\u0438\u0431\u0443\u0434\u044c \u0438\u043c\u0435\u043d\u0435\u043c \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 <code>_MyHomePageState<\/code>.<\/p>\n<\/li>\n<\/ol>\n<pre><code>\/\/ main.dart static const platform = const MethodChannel('com.souvikbiswas.bmi\/data');<\/code><\/pre>\n<ol start=\"2\">\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043c\u0435\u0442\u043e\u0434 <code>_receiveFromHost()<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438, \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u043c\u043e\u0434\u0443\u043b\u044f Flutter.<\/p>\n<\/li>\n<\/ol>\n<pre><code>\/\/ main.dart Future&lt;void> _receiveFromHost(MethodCall call) async {    var jData;      try {      print(call.method);        if (call.method == \"fromHostToClient\") {        final String data = call.arguments;        print(call.arguments);        jData = await jsonDecode(data);      }    } on PlatformException catch (error) {      print(error);    }      setState(() {      jData1 = jData;      if (jData['color'] == 'blue') {        color = Colors.blue;      } else if (jData['color'] == 'green') {        color = Colors.green;      } else {        color = Colors.pink;      }    });  }<\/code><\/pre>\n<ol start=\"3\">\n<li>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c <code>_receiveFromHost()<\/code>\u043c\u0435\u0442\u043e\u0434 \u043a\u0430\u043a \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 <code>setMethodCallHandler<\/code>.<\/p>\n<\/li>\n<\/ol>\n<pre><code>\/\/ main.dart _MyHomePageState() {      platform.setMethodCallHandler(_receiveFromHost); }<\/code><\/pre>\n<ol start=\"4\">\n<li>\n<p>\u041f\u0438\u0448\u0435\u043c \u043a\u043e\u0434 \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u0430 build, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Platform Channel:<\/p>\n<\/li>\n<\/ol>\n<pre><code>\/\/ main.dart  @override   Widget build(BuildContext context) {     return Scaffold(       body: Container(         color: color, \/\/ Updated         child: Center(           child: Column(             \/\/ ...             children: &lt;Widget>[               Text(                 'YOUR BMI',                 \/\/ ...               ),               Text(                 jData1['value'], \/\/ Updated                 \/\/ ...               ),               Text(                 jData1['advice'], \/\/ Updated                 \/\/ ...               ),             ],           ),         ),       ),     );   } }<\/code><\/pre>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f iOS (\u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445)<\/h3>\n<ol>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u0430\u043d\u0430\u043b \u0434\u043b\u044f \u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0441 \u043c\u043e\u0434\u0443\u043b\u0435\u043c Flutter<\/p>\n<\/li>\n<\/ol>\n<pre><code>\/\/ Define inside calculatePressed() method let bmiDataChannel = FlutterMethodChannel(name: \"com.souvikbiswas.bmi\/data\", binaryMessenger: flutterViewController.binaryMessenger)<\/code><\/pre>\n<ol start=\"2\">\n<li>\n<p>\u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u043a\u0430\u043d\u0430\u043b\u0443<\/p>\n<\/li>\n<\/ol>\n<pre><code>\/\/ Define inside calculatePressed() method  let bmiDataChannel = FlutterMethodChannel(name: \"com.souvikbiswas.bmi\/data\", binaryMessenger: flutterViewController.binaryMessenger)        let jsonObject: NSMutableDictionary = NSMutableDictionary()  jsonObject.setValue(bmiValue, forKey: \"value\")  jsonObject.setValue(bmiAdvice, forKey: \"advice\")  jsonObject.setValue(bmiColor, forKey: \"color\")    var convertedString: String? = nil    do {      let data1 =  try JSONSerialization.data(withJSONObject: jsonObject, options: JSONSerialization.WritingOptions.prettyPrinted)      convertedString = String(data: data1, encoding: String.Encoding.utf8)  } catch let myJSONError {      print(myJSONError)  }        bmiDataChannel.invokeMethod(\"fromHostToClient\", arguments: convertedString)<\/code><\/pre>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u0432\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e\u0434\u043e\u0448\u043b\u0430 \u043a \u043a\u043e\u043d\u0446\u0443. \u041c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u044d\u043a\u0440\u0430\u043d\u0430 Flutter \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f iOS \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 platform channel. \u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u0440\u0435\u0447\u044c \u0431\u0443\u0434\u0435\u0442 \u0438\u0434\u0442\u0438 \u043f\u0440\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u00abHot Reload\u00bb, \u00abHot Restart\u00bb \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 Codemagic.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0430\u043d\u043e\u043d\u0441, \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0439\u0442\u0435\u0441\u044c \u043d\u0430 \u043d\u0430\u0448 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c-\u043a\u0430\u043d\u0430\u043b <a href=\"https:\/\/t.me\/+YDX3yq4hGLY2NGMy\" rel=\"noopener noreferrer nofollow\"><u>Flutter. \u041c\u043d\u043e\u0433\u043e<\/u><\/a>!<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u043b\u0438 1 \u0447\u0430\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u0438, \u0442\u043e \u043e\u043d\u0430 <a href=\"https:\/\/habr.com\/ru\/articles\/775298\/\" rel=\"noopener noreferrer nofollow\"><u>\u0437\u0434\u0435\u0441\u044c<\/u><\/a>.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/775928\/\"> https:\/\/habr.com\/ru\/articles\/775928\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-361017","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/361017","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=361017"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/361017\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=361017"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=361017"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=361017"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}