{"id":463477,"date":"2025-06-15T21:00:48","date_gmt":"2025-06-15T21:00:48","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=463477"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=463477","title":{"rendered":"<span>Dart Native Assets: \u041f\u043e\u043b\u043d\u043e\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043e\u0442 \u043d\u043e\u0432\u0438\u0447\u043a\u0430 \u0434\u043e \u043f\u0440\u043e\u0444\u0438<\/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<h4>\u0414\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u043b\u0435\u043d\u0438\u044f:<\/h4>\n<ul>\n<li>\n<p>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 Native Assets &#8212; \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432<\/p>\n<\/li>\n<li>\n<p>\u0418\u0441\u0442\u043e\u0440\u0438\u044f \u0438 \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u044f<\/p>\n<\/li>\n<li>\n<p>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u044b<\/p>\n<\/li>\n<li>\n<p>Build Hooks &#8212; \u0441\u0435\u0440\u0434\u0446\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u0435 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>\u041b\u0443\u0447\u0448\u0438\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438<\/p>\n<\/li>\n<li>\n<p>Troubleshooting \u0438 \u043e\u0442\u043b\u0430\u0434\u043a\u0430<\/p>\n<\/li>\n<li>\n<p>\u042d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0438 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0435 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u0435<\/p>\n<\/li>\n<li>\n<p>\u0420\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u043a\u0435\u0439\u0441\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f<\/p>\n<\/li>\n<\/ul>\n<h4>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 Native Assets &#8212; \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432<\/h4>\n<h3>\u041f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438<\/h3>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435, \u0447\u0442\u043e \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c Dart-\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430, \u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u0443\u044e \u043d\u0430 C, C++, Rust \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u043e\u043c \u044f\u0437\u044b\u043a\u0435. \u0420\u0430\u043d\u044c\u0448\u0435 \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0441\u043b\u043e\u0436\u043d\u043e &#8212; \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443, \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u0442\u0435\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u043f\u043e\u043f\u0430\u043b\u0430 \u0432 \u043d\u0443\u0436\u043d\u043e\u0435 \u043c\u0435\u0441\u0442\u043e, \u0438 \u043f\u0438\u0441\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430.<\/p>\n<p>Native Assets &#8212; \u044d\u0442\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0432\u0435\u0441\u044c \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441. \u041e\u043d\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0430\u0448\u0435\u043c\u0443 Dart-\u043f\u0430\u043a\u0435\u0442\u0443 &#171;\u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0432 \u0441\u0435\u0431\u044f&#187; \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043a\u043e\u0434 \u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0435\u0433\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c.<\/p>\n<h3>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u044f \u0438\u0437 \u0436\u0438\u0437\u043d\u0438<\/h3>\n<p>\u042d\u0442\u043e \u043a\u0430\u043a \u0437\u0430\u043a\u0430\u0437 \u0435\u0434\u044b \u0441 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u043e\u0439:<\/p>\n<ul>\n<li>\n<p><strong>\u0420\u0430\u043d\u044c\u0448\u0435:<\/strong> \u0412\u044b \u0441\u0430\u043c\u0438 \u043f\u043e\u043a\u0443\u043f\u0430\u043b\u0438 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u044b, \u0433\u043e\u0442\u043e\u0432\u0438\u043b\u0438, \u043c\u044b\u043b\u0438 \u043f\u043e\u0441\u0443\u0434\u0443.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421 Native Assets:<\/strong> \u0412\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0435 &#171;\u0445\u043e\u0447\u0443 \u043f\u0438\u0446\u0446\u0443&#187;, \u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0441\u0430\u043c\u0430 \u0437\u0430\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438 \u0434\u0430\u0436\u0435 \u0443\u0431\u0438\u0440\u0430\u0435\u0442 \u0437\u0430 \u0441\u043e\u0431\u043e\u0439.<\/p>\n<\/li>\n<\/ul>\n<h3>\u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435<\/h3>\n<p>Native Assets \u2014 \u044d\u0442\u043e \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0432 Dart, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0430\u043a\u0435\u0442\u0430\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e Dart-\u043a\u043e\u0434, \u043d\u043e \u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u044f\u0437\u044b\u043a\u0430\u0445 (C, C++, Rust \u0438 \u0434\u0440.). \u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0431\u043e\u0440\u043a\u043e\u0439 \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0432 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 (<code>.so<\/code>, <code>.dll<\/code>, <code>.dylib<\/code>), \u0438\u0445 \u0443\u043f\u0430\u043a\u043e\u0432\u043a\u043e\u0439 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043d\u0438\u043c \u0438\u0437 Dart-\u043a\u043e\u0434\u0430 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 FFI (Foreign Function Interface).<\/p>\n<h4>\u0418\u0441\u0442\u043e\u0440\u0438\u044f \u0438 \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u044f<\/h4>\n<h3>\u0414\u043e Native Assets (\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0430)<\/h3>\n<p>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0445\u043e\u0447\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c C-\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443:<\/p>\n<ol>\n<li>\n<p>\u0412\u0440\u0443\u0447\u043d\u0443\u044e \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b.<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043f\u0438\u0440\u0443\u0435\u0442 <code>.so<\/code>\/<code>.dll<\/code>\/<code>.dylib<\/code> \u0444\u0430\u0439\u043b\u044b \u0432 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0441\u0442\u0430.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0438\u0448\u0435\u0442 FFI-\u0431\u0438\u043d\u0434\u0438\u043d\u0433\u0438.<\/p>\n<\/li>\n<li>\n<p>\u041c\u043e\u043b\u0438\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442 \u0432\u0441\u0435 \u044d\u0442\u043e \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438.<\/p>\n<\/li>\n<\/ol>\n<h3>\u0421 Native Assets (\u0441\u0432\u0435\u0442\u043b\u043e\u0435 \u0431\u0443\u0434\u0443\u0449\u0435\u0435)<\/h3>\n<p>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0445\u043e\u0447\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c C-\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443:<\/p>\n<ol>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u0432 <code>pubspec.yaml<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u041e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u0431\u043e\u0440\u043a\u0438 \u0432 <code>hook\/build.dart<\/code> (\u043e\u0434\u0438\u043d \u0440\u0430\u0437).<\/p>\n<\/li>\n<li>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0441\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442 \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442.<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432\u0435\u0437\u0434\u0435 &#171;\u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438&#187;.<\/p>\n<\/li>\n<\/ol>\n<h3>Timeline \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044f<\/h3>\n<ul>\n<li>\n<p><strong>Dart 3.2:<\/strong> \u041f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043f\u0435\u0440\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f Native Assets \u0437\u0430 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u043c \u0444\u043b\u0430\u0433\u043e\u043c <code>--enable-experiment=native-assets<\/code>.<\/p>\n<\/li>\n<li>\n<p><strong>Dart 3.4 (\u041c\u0430\u0439 2024):<\/strong> <strong>\u0421\u0442\u0430\u0431\u0438\u043b\u0438\u0437\u0430\u0446\u0438\u044f Native Assets.<\/strong> \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u0442\u0430\u043b\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0444\u043b\u0430\u0433 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f.<\/p>\n<\/li>\n<li>\n<p><strong>Flutter 3.22 (\u041c\u0430\u0439 2024):<\/strong> <strong>\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f Native Assets \u0432\u043e Flutter.<\/strong> \u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u0441\u0442\u0430\u043b\u0430 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0430 \u0432\u0441\u0435\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430\u0445.<\/p>\n<\/li>\n<\/ul>\n<h4>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u044b<\/h4>\n<pre><code class=\"coffeescript\">\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510    \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510    \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u2502   Dart Package  \u2502\u2500\u2500\u2500\u25b6\u2502   Build Hooks   \u2502\u2500\u2500\u2500\u25b6\u2502  Native Assets  \u2502 \u2502                 \u2502    \u2502                 \u2502    \u2502                 \u2502 \u2502 - pubspec.yaml  \u2502    \u2502 - hook\/build.dart\u2502   \u2502 - .so\/.dll\/.dylib\u2502 \u2502 - lib\/*.dart    \u2502    \u2502                  \u2502   \u2502 - metadata.json \u2502 \u2502 - src\/*.c       \u2502    \u2502                  \u2502   \u2502                 \u2502 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518    \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518    \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 <\/code><\/pre>\n<ol>\n<li>\n<p><strong>Package Structure<\/strong> <\/p>\n<pre><code class=\"dart\">my_native_package\/ \u251c\u2500\u2500 pubspec.yaml          # \u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u043f\u0430\u043a\u0435\u0442\u0430 \u251c\u2500\u2500 lib\/ \u2502   \u2514\u2500\u2500 my_package.dart   # Dart API \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c \u251c\u2500\u2500 src\/ \u2502   \u251c\u2500\u2500 my_lib.c          # \u041d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u2502   \u2514\u2500\u2500 my_lib.h          # \u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u2514\u2500\u2500 hook\/     \u2514\u2500\u2500 build.dart        # \u0421\u043a\u0440\u0438\u043f\u0442-\u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u0441\u0431\u043e\u0440\u043a\u0435 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 <\/code><\/pre>\n<\/li>\n<li>\n<p><strong>Build System Flow<\/strong> <\/p>\n<ol>\n<li>\n<p><code>dart pub get<\/code> \u0438\u043b\u0438 <code>flutter build<\/code> \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 <code>hook\/build.dart<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u044d\u0442\u043e\u0442 \u0441\u043a\u0440\u0438\u043f\u0442 (build hook) \u0432 \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b.<\/p>\n<\/li>\n<li>\n<p>Hook \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043a\u043e\u0434, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u044b (GCC, Clang, MSVC) \u0438\u043b\u0438 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b (Cargo, CMake).<\/p>\n<\/li>\n<li>\n<p>Hook \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 \u0430\u0441\u0441\u0435\u0442\u0430\u0445 (\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u0445).<\/p>\n<\/li>\n<li>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u0441\u0431\u043e\u0440\u043a\u0438 \u0443\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u044d\u0442\u0438 \u0430\u0441\u0441\u0435\u0442\u044b \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c.<\/p>\n<\/li>\n<li>\n<p>Dart-\u043a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c FFI \u0434\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u0430 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438.<\/p>\n<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<h4>Build Hooks &#8212; \u0441\u0435\u0440\u0434\u0446\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b<\/h4>\n<h3>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 Build Hook<\/h3>\n<p>Build Hook \u2014 \u044d\u0442\u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 Dart-\u0441\u043a\u0440\u0438\u043f\u0442 (<code>hook\/build.dart<\/code>), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0441\u0431\u043e\u0440\u043a\u0438:<\/p>\n<ul>\n<li>\n<p>\u041a\u0430\u043a\u043e\u0439 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043a\u043e\u0434 \u043d\u0443\u0436\u043d\u043e \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u043a \u0438\u043c\u0435\u043d\u043d\u043e \u0435\u0433\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c (\u043a\u0430\u043a\u0438\u0435 \u0444\u043b\u0430\u0433\u0438, \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438).<\/p>\n<\/li>\n<li>\n<p>\u0413\u0434\u0435 \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<\/li>\n<\/ul>\n<h3>\u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 hook\/build.dart (\u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438)<\/h3>\n<p><strong>\u0412\u0430\u0436\u043d\u043e:<\/strong> \u042d\u0442\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043f\u0440\u044f\u043c\u043e\u0439 \u0432\u044b\u0437\u043e\u0432 <code>gcc<\/code> \u0438 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u044b\u043c. \u041e\u043d \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430. \u0412 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u043e\u0431\u0435\u0440\u0442\u043a\u0438, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a <code>native_toolchain_c<\/code>.<\/p>\n<pre><code class=\"dart\">\/\/ hook\/build.dart import 'package:native_assets_cli\/native_assets_cli.dart'; import 'dart:io';  void main(List&lt;String&gt; args) async {   await build(args, (config, output) async {     \/\/ \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c, \u0447\u0442\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c     final packageName = config.packageName;     final sourceFile = config.packageRoot.resolve('src\/my_lib.c');     final outDir = config.outputDirectory;      \/\/ \u0418\u043c\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b     String libName;     if (config.targetOS == OS.windows) {       libName = 'my_lib.dll';     } else if (config.targetOS == OS.macOS) {       libName = 'libmy_lib.dylib';     } else {       libName = 'libmy_lib.so';     }     final outFile = outDir.resolve(libName);      \/\/ \u041a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c C \u043a\u043e\u0434 \u0432 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443     final result = await Process.run(       'gcc',       [         '-shared',         '-fPIC',         '-o',         outFile.toFilePath(),         sourceFile.toFilePath(),       ],     );      if (result.exitCode != 0) {       throw Exception('Compilation failed: ${result.stderr}');     }      \/\/ \u0421\u043e\u043e\u0431\u0449\u0430\u0435\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435     output.addAsset(NativeCodeAsset(       package: packageName,       name: 'src\/my_lib.c', \/\/ \u0418\u043c\u044f \u0430\u0441\u0441\u0435\u0442\u0430 \u0434\u043e\u043b\u0436\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043f\u0443\u0442\u0438 \u043a \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0443       file: outFile,       linkMode: LinkMode.dynamic,       os: config.targetOS,       architecture: config.targetArchitecture,     ));   }); } <\/code><\/pre>\n<h3>\u041f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u0439 \u0438 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 native_toolchain_c<\/h3>\n<p>\u042d\u0442\u043e\u0442 \u043f\u0430\u043a\u0435\u0442 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 <code>CBuilder<\/code> \u0434\u043b\u044f \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438.<\/p>\n<pre><code class=\"dart\">\/\/ hook\/build.dart import 'package:native_assets_cli\/native_assets_cli.dart'; import 'package:native_toolchain_c\/native_toolchain_c.dart';  void main(List&lt;String&gt; args) async {   await build(args, (config, output) async {     final cbuilder = CBuilder.library(       name: 'my_complex_lib',       assetName: 'path\/to\/my_lib.dart', \/\/ \u041f\u0443\u0442\u044c \u043a Dart \u0444\u0430\u0439\u043b\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443       sources: [         'src\/core.c',         'src\/utils.c',       ],       includes: [         'src\/include\/',       ],       defines: {         'VERSION': '1.0.0',         'DEBUG': config.buildMode == BuildMode.debug ? '1' : '0',       },     );      await cbuilder.run(       buildConfig: config,       buildOutput: output,       \/\/ \u0414\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043b\u043e\u0433\u0433\u0435\u0440       \/\/ logger: Logger()..level = Level.all,     );   }); } <\/code><\/pre>\n<h4>\u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b<\/h4>\n<h3>\u041f\u0440\u0438\u043c\u0435\u0440 1: \u041f\u0440\u043e\u0441\u0442\u0430\u044f \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430<\/h3>\n<p><strong>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/strong><\/p>\n<pre><code class=\"dart\">math_native\/ \u251c\u2500\u2500 pubspec.yaml \u251c\u2500\u2500 lib\/ \u2502   \u2514\u2500\u2500 math_native.dart \u251c\u2500\u2500 src\/ \u2502   \u251c\u2500\u2500 math_ops.c \u2502   \u2514\u2500\u2500 math_ops.h \u2514\u2500\u2500 hook\/     \u2514\u2500\u2500 build.dart <\/code><\/pre>\n<p><strong>C-\u043a\u043e\u0434 (<\/strong><code><strong>src\/math_ops.c<\/strong><\/code><strong>) <\/strong>(<strong>C<\/strong> \u043d\u0435\u0442 \u0432 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435 \u0445\u0430\u0431\u0440\u0430 \u0432 \u0432\u044b\u043f\u0430\u0434\u0430\u044e\u0449\u0435\u043c \u0441\u043f\u0438\u0441\u043a\u0435 \u044f\u0437\u044b\u043a\u043e\u0432, \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b \u0421++)<\/p>\n<pre><code class=\"cpp\">\/\/ src\/math_ops.c #include \"math_ops.h\"  \/\/ \u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0424\u0438\u0431\u043e\u043d\u0430\u0447\u0447\u0438 int fibonacci(int n) {     if (n &lt;= 1) return n;     int a = 0, b = 1, c;     for (int i = 2; i &lt;= n; i++) {         c = a + b;         a = b;         b = c;     }     return b; } <\/code><\/pre>\n<p><strong>\u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u044b\u0439 \u0444\u0430\u0439\u043b (<\/strong><code><strong>src\/math_ops.h<\/strong><\/code><strong>)<\/strong><\/p>\n<pre><code class=\"cpp\">\/\/ src\/math_ops.h #ifndef MATH_OPS_H #define MATH_OPS_H  \/\/ Dart FFI \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u044f\u0432\u043d\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0434\u043b\u044f Windows #if defined(_WIN32) #define API __declspec(dllexport) #else #define API #endif  API int fibonacci(int n);  #endif <\/code><\/pre>\n<p><strong>Build Hook (<\/strong><code><strong>hook\/build.dart<\/strong><\/code><strong>)<\/strong><\/p>\n<pre><code class=\"cpp\">\/\/ hook\/build.dart \/\/ \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u043a\u0435\u0442 native_toolchain_rust import 'package.native_assets_cli\/native_assets_cli.dart'; import 'package.native_toolchain_rust\/native_toolchain_rust.dart';  void main(List&lt;String&gt; args) async {   await build(args, (config, output) async {     \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0431\u043e\u0440\u0449\u0438\u043a \u0434\u043b\u044f Rust-\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438     final rustBuilder = RustBuilder.library(       name: 'string_processor', \/\/ \u0418\u043c\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0430\u043a\u0435\u0442\u0430 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 Cargo.toml       \/\/ \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c Dart-\u0444\u0430\u0439\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0443 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443       assetName: 'package:\u0438\u043c\u044f_\u0432\u0430\u0448\u0435\u0433\u043e_\u043f\u0430\u043a\u0435\u0442\u0430\/\u0438\u043c\u044f_dart_\u0444\u0430\u0439\u043b\u0430.dart',     );      \/\/ \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u0431\u043e\u0440\u043a\u0443     await rustBuilder.run(       buildConfig: config,       buildOutput: output,     );   }); }<\/code><\/pre>\n<p><strong>Dart API (<\/strong><code><strong>lib\/math_native.dart<\/strong><\/code><strong>)<\/strong><\/p>\n<pre><code class=\"cpp\">\/\/ lib\/math_native.dart import 'dart:ffi';  \/\/ \u0410\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f @Native \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 FFI \u043d\u0430 \u0438\u043c\u044f \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \/\/ \u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u0441\u0431\u043e\u0440\u043a\u0438 Native Assets \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0430\u0439\u0434\u0435\u0442 \u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442 \/\/ \u043d\u0443\u0436\u043d\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443, \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0434\u043b\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b. @Native&lt;Int32 Function(Int32)&gt;('fibonacci') external int _fibonacci(int n);  \/\/\/ \u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0447\u0438\u0441\u043b\u0430 \u0424\u0438\u0431\u043e\u043d\u0430\u0447\u0447\u0438 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. int fibonacci(int n) =&gt; _fibonacci(n); <\/code><\/pre>\n<p><code><strong>pubspec.yaml<\/strong><\/code><\/p>\n<pre><code class=\"yaml\">name: math_native description: Fast native math operations. version: 1.0.0 publish_to: 'none' # \u0414\u043b\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430  environment:   sdk: '&gt;=3.4.0 &lt;4.0.0'  dependencies:   ffi: ^2.1.0  # \u041f\u0430\u043a\u0435\u0442\u044b \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c, # Dart SDK \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0438\u0445 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438. # dev_dependencies: #   native_assets_cli: ... #   native_toolchain_c: ... <\/code><\/pre>\n<h3>\u041f\u0440\u0438\u043c\u0435\u0440 2: \u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0441 Rust<\/h3>\n<p><strong>Rust-\u043a\u043e\u0434 (<\/strong><code><strong>src\/<\/strong><\/code><a href=\"http:\/\/lib.rs\" rel=\"noopener noreferrer nofollow\"><code><strong>lib.rs<\/strong><\/code><\/a><strong>)<\/strong><\/p>\n<pre><code class=\"rust\">\/\/ src\/lib.rs use std::ffi::{CStr, CString}; use std::os::raw::c_char;  #[no_mangle] pub extern \"C\" fn process_string(input: *const c_char) -&gt; *mut c_char {     let c_str = unsafe { CStr::from_ptr(input) };     let rust_string = c_str.to_string_lossy();      \/\/ \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 Rust (\u0440\u0435\u0432\u0435\u0440\u0441 \u0438 \u0432\u0435\u0440\u0445\u043d\u0438\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440)     let processed = rust_string.chars().rev().collect::&lt;String&gt;().to_uppercase();      let c_string = CString::new(processed).unwrap();     c_string.into_raw() }  #[no_mangle] pub extern \"C\" fn free_string(ptr: *mut c_char) {     if !ptr.is_null() {         unsafe {             \/\/ \u0412\u043e\u0441\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c CString \u0438\u0437 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u0438 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u043c \u043f\u0430\u043c\u044f\u0442\u044c             let _ = CString::from_raw(ptr);         };     } } <\/code><\/pre>\n<p><code><strong>Cargo.toml<\/strong><\/code><\/p>\n<p>Ini, TOML (TOML \u043d\u0435\u0442 \u0432 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435 \u0445\u0430\u0431\u0440\u0430 \u0432 \u0432\u044b\u043f\u0430\u0434\u0430\u044e\u0449\u0435\u043c \u0441\u043f\u0438\u0441\u043a\u0435 \u044f\u0437\u044b\u043a\u043e\u0432)<\/p>\n<pre><code class=\"rust\">[package] name = \"string_processor\" version = \"0.1.0\" edition = \"2021\"  [lib] crate-type = [\"cdylib\"] <\/code><\/pre>\n<p><strong>Build Hook \u0434\u043b\u044f Rust (<\/strong><code><strong>hook\/build.dart<\/strong><\/code><strong>)<\/strong><\/p>\n<pre><code class=\"dart\">\/\/ hook\/build.dart import 'dart:io'; import 'package:native_assets_cli\/native_assets_cli.dart';  void main(List&lt;String&gt; args) async {   await build(args, (config, output) async {     \/\/ \u0412\u044b\u0437\u043e\u0432 Cargo \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 Rust \u043f\u0440\u043e\u0435\u043a\u0442\u0430     final result = await Process.run(       'cargo',       ['build', '--release'],       workingDirectory: config.packageRoot.toFilePath(),     );      if (result.exitCode != 0) {       throw Exception('Rust build failed: ${result.stderr}');     }      \/\/ \u041d\u0430\u0445\u043e\u0434\u0438\u043c \u043f\u0443\u0442\u044c \u043a \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435     \/\/ ... \u043b\u043e\u0433\u0438\u043a\u0430 \u043f\u043e\u0438\u0441\u043a\u0430 .dll\/.so\/.dylib \u0432 target\/release\/ ...     \/\/ \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u043e\u043f\u0443\u0441\u0442\u0438\u043c \u044d\u0442\u0443 \u0447\u0430\u0441\u0442\u044c      \/\/ \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0430\u0441\u0441\u0435\u0442 \u0432 \u0432\u044b\u0432\u043e\u0434 (\u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043a\u043e\u0434\u0435 \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0444\u0430\u0439\u043b)     \/\/ output.addAsset(...)   }); } \/\/ \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0434\u043b\u044f Rust \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b-\u043e\u0431\u0435\u0440\u0442\u043a\u0438, \/\/ \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a `native_toolchain_rust`, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u0443\u044e\u0442 \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441. <\/code><\/pre>\n<h4>\u041f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u0435 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438<\/h4>\n<h3>1. \u0423\u0441\u043b\u043e\u0432\u043d\u0430\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f<\/h3>\n<p>Build hook \u043c\u043e\u0436\u0435\u0442 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0441\u0431\u043e\u0440\u043a\u0438 (<code>config<\/code>) \u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u0438\u043b\u0438 \u0444\u043b\u0430\u0433\u0438.<\/p>\n<pre><code class=\"dart\">\/\/ hook\/build.dart void main(List&lt;String&gt; args) async {   await build(args, (config, output) async {     final sources = &lt;String&gt;['src\/core.c'];     final defines = &lt;String, String&gt;{};      \/\/ \u041f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u043e-\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0439 \u043a\u043e\u0434     switch (config.targetOS) {       case OS.windows:         sources.add('src\/platform\/windows.c');         defines['PLATFORM_WINDOWS'] = '1';         break;       case OS.linux:         sources.add('src\/platform\/linux.c');         defines['PLATFORM_LINUX'] = '1';         break;       case OS.macOS:         sources.add('src\/platform\/macos.c');         defines['PLATFORM_MACOS'] = '1';         break;       default:         \/\/ \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043d\u0435\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c     }      final cbuilder = CBuilder.library(       name: 'cross_platform_lib',       assetName: 'package:my_package\/my_package.dart',       sources: sources,       defines: defines,     );      await cbuilder.run(buildConfig: config, buildOutput: output);   }); } <\/code><\/pre>\n<h3>2. \u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u043c\u0438<\/h3>\n<p>\u0412 build hook \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438.<\/p>\n<pre><code class=\"dart\">\/\/ hook\/build.dart \/\/ (\u041a\u043e\u043d\u0446\u0435\u043f\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440) void main(List&lt;String&gt; args) async {   await build(args, (config, output) async {     final depsDir = config.outputDirectory.resolve('deps');      \/\/ \u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0438 \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, libjpeg)     if (!await Directory.fromUri(depsDir).exists()) {       await downloadAndExtract(         url: 'https:\/\/example.com\/libjpeg.tar.gz',         destination: depsDir,       );       \/\/ \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c .\/configure &amp;&amp; make \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438       await buildDependency(depsDir);     }      final cbuilder = CBuilder.library(       name: 'my_image_lib',       assetName: 'package:my_package\/my_package.dart',       sources: ['src\/image_utils.c'],       includes: [         'src\/',         depsDir.resolve('include').path,       ],       \/\/ \u041b\u0438\u043d\u043a\u0443\u0435\u043c\u0441\u044f \u0441\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c\u044e       libraries: [         depsDir.resolve('lib\/libjpeg.a').path,       ],     );      await cbuilder.run(buildConfig: config, buildOutput: output);   }); } <\/code><\/pre>\n<p><em>\u0412\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <\/em><code><em>downloadAndExtract<\/em><\/code><em> \u0438 <\/em><code><em>buildDependency<\/em><\/code><em> \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e.<\/em><\/p>\n<h4>\u041b\u0443\u0447\u0448\u0438\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438<\/h4>\n<h3>1. \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/h3>\n<p>\u0425\u043e\u0440\u043e\u0448\u043e \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u043e\u0431\u043b\u0435\u0433\u0447\u0430\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443.<\/p>\n<pre><code class=\"typescript\">my_native_package\/ \u251c\u2500\u2500 pubspec.yaml \u251c\u2500\u2500 README.md \u251c\u2500\u2500 lib\/ \u2502   \u251c\u2500\u2500 my_package.dart          # \u041f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 Dart API \u2502   \u2514\u2500\u2500 src\/ \u2502       \u251c\u2500\u2500 bindings.dart        # FFI-\u0431\u0438\u043d\u0434\u0438\u043d\u0433\u0438 (@Native) \u2502       \u2514\u2500\u2500 exceptions.dart      # \u041a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u251c\u2500\u2500 src\/                         # \u041d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043a\u043e\u0434 \u2502   \u251c\u2500\u2500 core\/ \u2502   \u2502   \u251c\u2500\u2500 api.h                # \u041f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 C API \u2502   \u2502   \u2514\u2500\u2500 api.c \u2502   \u2514\u2500\u2500 platform\/                # \u041f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u043e-\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0439 \u043a\u043e\u0434 \u2514\u2500\u2500 hook\/     \u2514\u2500\u2500 build.dart               # Build hook <\/code><\/pre>\n<h3>2. \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a \u0432 Build Hooks<\/h3>\n<p>Build hook \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u043c \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0430\u0445.<\/p>\n<pre><code class=\"dart\">\/\/ hook\/build.dart void main(List&lt;String&gt; args) async {   await build(args, (config, output) async {     try {       \/\/ \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, CMake)       await _ensureToolExists('cmake');        final cbuilder = CBuilder.library(...);       await cbuilder.run(         buildConfig: config,         buildOutput: output,         logger: Logger.root, \/\/ \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435       );      } on ToolNotFoundException catch (e) {       print('\u041e\u0448\u0438\u0431\u043a\u0430 \u0441\u0431\u043e\u0440\u043a\u0438: ${e.message}');       print('\u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u044f: \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 ${e.toolName} \u0438 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432 PATH.');       rethrow;     } catch (e, stackTrace) {       print('\u041d\u0435\u043f\u0440\u0435\u0434\u0432\u0438\u0434\u0435\u043d\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0441\u0431\u043e\u0440\u043a\u0438: $e');       print('\u0421\u0442\u0435\u043a \u0432\u044b\u0437\u043e\u0432\u043e\u0432: $stackTrace');       rethrow;     }   }); } \/\/ \u0412\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f _ensureToolExists \u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 ToolNotFoundException <\/code><\/pre>\n<h3>3. \u041a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u0430\u044f \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c \u0432 Dart<\/h3>\n<p><strong>\u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434:<\/strong> \u0421 Native Assets \u0432\u0430\u043c <strong>\u043d\u0435 \u043d\u0443\u0436\u043d\u043e<\/strong> \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u043f\u043e\u0434 \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u0432 Dart. \u042d\u0442\u0430 \u043b\u043e\u0433\u0438\u043a\u0430 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 <code>hook\/build.dart<\/code>. Dart-\u043a\u043e\u0434 \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0447\u0438\u0441\u0442\u044b\u043c \u0438 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u043e-\u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u043c.<\/p>\n<p><strong>\u0423\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 (\u041d\u0415 \u0418\u0421\u041f\u041e\u041b\u042c\u0417\u041e\u0412\u0410\u0422\u042c \u0421 NATIVE ASSETS):<\/strong><\/p>\n<pre><code class=\"dart\">\/\/ \u041d\u0415\u041f\u0420\u0410\u0412\u0418\u041b\u042c\u041d\u041e: \u0420\u0443\u0447\u043d\u0430\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 if (Platform.isWindows) {   DynamicLibrary.open('my_lib.dll'); } \/\/ ... \u0438 \u0442.\u0434. <\/code><\/pre>\n<p><strong>\u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 Dart-\u043a\u043e\u0434:<\/strong><\/p>\n<pre><code class=\"dart\">\/\/ lib\/src\/bindings.dart import 'dart:ffi';  \/\/ \u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430 Windows, macOS, Linux, Android \u0438 iOS \/\/ \u0431\u0435\u0437 \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439. @Native&lt;Int32 Function(Int32)&gt;('my_function') external int _myFunction(int value);  class MyLib {   static int myFunction(int value) {     try {       return _myFunction(value);     } catch (e) {       \/\/ \u041c\u043e\u0436\u043d\u043e \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443 FFI \u0432 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435       throw NativeException('Failed to call my_function: $e');     }   } }  class NativeException implements Exception {   final String message;   NativeException(this.message); } <\/code><\/pre>\n<h3>4. \u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 Native Assets<\/h3>\n<p>\u0422\u0435\u0441\u0442\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043a\u0430\u043a \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435, \u0442\u0430\u043a \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043e\u0448\u0438\u0431\u043e\u043a.<\/p>\n<pre><code class=\"dart\">\/\/ test\/native_test.dart import 'package:test\/test.dart'; import 'package:math_native\/math_native.dart'; \/\/ \u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0448 \u043f\u0430\u043a\u0435\u0442  void main() {   group('Native Fibonacci Tests', () {     test('should return correct values for base cases', () {       expect(fibonacci(0), 0);       expect(fibonacci(1), 1);     });      test('should calculate fibonacci correctly for a small number', () {       expect(fibonacci(10), 55);     });      \/\/ \u041c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0442\u0435\u0441\u0442\u044b \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c     test('should execute within reasonable time', () {       final stopwatch = Stopwatch()..start();       fibonacci(40); \/\/ \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430       stopwatch.stop();       expect(stopwatch.elapsedMilliseconds, lessThan(100));     });   }); } <\/code><\/pre>\n<h4>Troubleshooting \u0438 \u043e\u0442\u043b\u0430\u0434\u043a\u0430<\/h4>\n<h3>\u0427\u0430\u0441\u0442\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f<\/h3>\n<ol>\n<li>\n<p><strong>\u0421\u0431\u043e\u0440\u043a\u0430 \u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u043e\u0439<\/strong><\/p>\n<ul>\n<li>\n<p><strong>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/strong> \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u0441\u0431\u043e\u0440\u043a\u0443 \u0441 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u0435\u0442\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043b\u043e\u0433\u043e\u0432: <code>flutter build &lt;platform&gt; -v<\/code>. \u0418\u0449\u0438\u0442\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u043e\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 (Clang, GCC, MSVC) \u0438\u043b\u0438 \u043e\u0442 \u0432\u0430\u0448\u0435\u0433\u043e build hook.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><code><strong>UnsatisfiedLinkError<\/strong><\/code><strong> \u0438\u043b\u0438 <\/strong><code><strong>Lookup failed<\/strong><\/code><\/p>\n<ul>\n<li>\n<p><strong>\u041f\u0440\u0438\u0447\u0438\u043d\u0430:<\/strong> Dart FFI \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0439\u0442\u0438 \u043d\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e.<\/p>\n<\/li>\n<li>\n<p><strong>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/strong> <\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435, \u0447\u0442\u043e \u0438\u043c\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 <code>@Native&lt;...&gt;<\/code> (<code>'my_function'<\/code>) \u0442\u043e\u0447\u043d\u043e \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u0432 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u043c \u043a\u043e\u0434\u0435.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f C++ \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u0430 \u0432 <code>extern \"C\"<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f Windows \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>__declspec(dllexport)<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 <code>assetName<\/code> \u0432 <code>CBuilder.library()<\/code> \u0432 <code>hook\/build.dart<\/code>. \u041e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0430 Dart-\u0444\u0430\u0439\u043b, \u0433\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <code>@Native<\/code>.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>Build Hook \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f<\/strong><\/p>\n<ul>\n<li>\n<p><strong>\u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435:<\/strong> <\/p>\n<ul>\n<li>\n<p>\u0424\u0430\u0439\u043b \u0442\u043e\u0447\u043d\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <code>build.dart<\/code> \u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043f\u0430\u043f\u043a\u0435 <code>hook<\/code> \u0432 \u043a\u043e\u0440\u043d\u0435 \u043f\u0430\u043a\u0435\u0442\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 <code>dart pub get<\/code> \u0438\u043b\u0438 <code>flutter clean<\/code> \u0438 <code>flutter pub get<\/code>, \u0447\u0442\u043e\u0431\u044b \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0441\u0431\u043e\u0440\u043a\u0438 \u0437\u0430\u043d\u043e\u0432\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u0430 hook (\u0433\u043e\u0440\u044f\u0447\u0430\u044f \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0437\u0434\u0435\u0441\u044c \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442).<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h4>\u042d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0438 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0435 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u0435<\/h4>\n<h3>\u0422\u0435\u043a\u0443\u0449\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 (\u043d\u0435 \u0431\u0443\u0434\u0443\u0449\u0435\u0435)<\/h3>\n<ul>\n<li>\n<p><strong>\u0414\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u0431\u0438\u043d\u0434\u0438\u043d\u0433\u0438:<\/strong> \u0410\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f <code>@Native&lt;...&gt;<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u043d\u0438\u044f \u0441 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c.<\/p>\n<\/li>\n<li>\n<p><strong>\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0441 Flutter:<\/strong> Native Assets \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0432\u043e Flutter \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u043d\u0430 Android, iOS, Windows, macOS \u0438 Linux.<\/p>\n<\/li>\n<li>\n<p><strong>\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0441 IDE:<\/strong> IDE (VS Code, Android Studio) \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043f\u043e\u0434\u0441\u0432\u0435\u0442\u043a\u0443 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u043b\u0430\u0434\u043a\u0438 Dart-\u043a\u043e\u0434\u0430. \u041f\u0440\u044f\u043c\u043e\u0439 \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043a \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u043c\u0443 \u043a\u043e\u0434\u0443 \u043f\u043e\u043a\u0430 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b:<\/strong> \u0421\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0435\u0442 \u043f\u0430\u043a\u0435\u0442\u044b-\u043e\u0431\u0435\u0440\u0442\u043a\u0438 \u0434\u043b\u044f \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u0441\u0431\u043e\u0440\u043a\u0438 (<code>native_toolchain_c<\/code>, <code>native_toolchain_cmake<\/code>, <code>native_toolchain_rust<\/code>), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0430\u044e\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 build-\u0445\u0443\u043a\u043e\u0432.<\/p>\n<\/li>\n<\/ul>\n<h3>\u041f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f<\/h3>\n<ul>\n<li>\n<p><strong>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0431\u0438\u043d\u0434\u0438\u043d\u0433\u043e\u0432:<\/strong> \u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a <code>package:ffigen<\/code>, \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Native Assets, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c Dart-\u043a\u043e\u0434 \u0438\u0437 C\/C++ \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p><strong>\u0423\u043b\u0443\u0447\u0448\u0435\u043d\u043d\u0430\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0430:<\/strong> \u0420\u0430\u0431\u043e\u0442\u0430 \u043d\u0430\u0434 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u0431\u0435\u0441\u0448\u043e\u0432\u043d\u043e\u0439 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0441 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043e\u043c \u043c\u0435\u0436\u0434\u0443 Dart \u0438 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c.<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 WebAssembly (Wasm):<\/strong> \u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0441 Wasm \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u0442 \u0436\u0435 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043a\u043e\u0434 (\u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432 Wasm) \u0432 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445.<\/p>\n<\/li>\n<\/ul>\n<h4>\u0420\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u043a\u0435\u0439\u0441\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f<\/h4>\n<h3>\u041a\u0435\u0439\u0441 1: \u0412\u044b\u0441\u043e\u043a\u043e\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439<\/h3>\n<p><strong>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430:<\/strong> \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0439 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e \u0438\u0437-\u0437\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043d\u0430\u0434 \u043f\u0438\u043a\u0441\u0435\u043b\u044f\u043c\u0438 \u0432 Dart-\u043a\u043e\u0434\u0435.<\/p>\n<p><strong>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0441 Native Assets:<\/strong> \u0412\u044b\u043d\u0435\u0441\u0442\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0435\u043c\u043a\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b (\u0444\u0438\u043b\u044c\u0442\u0440\u044b, \u0440\u0430\u0437\u043c\u044b\u0442\u0438\u0435) \u0432 C\/C++ \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0438\u0445 \u0447\u0435\u0440\u0435\u0437 FFI.<\/p>\n<p><strong>Dart-\u043a\u043e\u0434 (c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u043c FFI):<\/strong><\/p>\n<pre><code class=\"dart\">\/\/ lib\/image_processor.dart import 'dart:ffi'; import 'dart:typed_data'; import 'package:ffi\/ffi.dart';  @Native&lt;Void Function(Pointer&lt;Uint8&gt;, Int32, Int32, Double)&gt;('apply_sepia_filter') external void _applySepiaFilter(Pointer&lt;Uint8&gt; imageData, int width, int height, double intensity);  void applySepiaFilter(Uint8List imageData, int width, int height, {double intensity = 1.0}) {   \/\/ \u0412\u044b\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u0430\u043c\u044f\u0442\u044c \u0432 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043a\u0443\u0447\u0435   final pointer = calloc&lt;Uint8&gt;(imageData.length);   \/\/ \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 Dart-\u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0432 \u043d\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c   pointer.asTypedList(imageData.length).setAll(0, imageData);    try {     \/\/ \u0412\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0431\u044b\u0441\u0442\u0440\u0443\u044e \u043d\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e     _applySepiaFilter(pointer, width, height, intensity);     \/\/ \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 Dart-\u043c\u0430\u0441\u0441\u0438\u0432     imageData.setAll(0, pointer.asTypedList(imageData.length));   } finally {     \/\/ \u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u043c \u043f\u0430\u043c\u044f\u0442\u044c     calloc.free(pointer);   } } <\/code><\/pre>\n<p><em>\u041d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043a\u043e\u0434 \u0434\u043b\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430 <\/em><code><em>apply_sepia_filter<\/em><\/code><em> \u043f\u0438\u0448\u0435\u0442\u0441\u044f \u043d\u0430 C.<\/em><\/p>\n<p><strong>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/strong> \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0432 \u0442\u0435\u043e\u0440\u0438\u0438 \u0432 10-15 \u0440\u0430\u0437 \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u043d\u043e \u0443 \u043c\u0435\u043d\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u043e\u0442 3 \u0434\u043e 8 \u0440\u0430\u0437, \u0435\u0441\u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u0432 \u043a\u0443\u0440\u0441\u0435 \u0447\u0442\u043e \u044f \u0434\u0435\u043b\u0430\u044e \u043d\u0435 \u0442\u0430\u043a &#8212; \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430 \u043f\u0440\u043e\u043a\u043e\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0439\u0442\u0435.<\/p>\n<h3>\u041a\u0435\u0439\u0441 2: \u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0441 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 C++ \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439<\/h3>\n<p><strong>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430:<\/strong> \u0415\u0441\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u0430\u044f, \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f C++ \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 3D-\u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 Dart-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438.<\/p>\n<p><strong>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/strong> \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u043e\u043d\u043a\u0443\u044e C-\u043e\u0431\u0435\u0440\u0442\u043a\u0443 (<code>wrapper<\/code>) \u0434\u043b\u044f C++ \u043a\u043e\u0434\u0430 \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0435\u0435 \u0447\u0435\u0440\u0435\u0437 Native Assets.<\/p>\n<p><strong>\u041e\u0431\u0435\u0440\u0442\u043a\u0430 C API (<\/strong><code><strong>src\/geometry_wrapper.cpp<\/strong><\/code><strong>)<\/strong><\/p>\n<pre><code class=\"cpp\">#include \"geometry_lib.hpp\" \/\/ \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f C++ \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430  \/\/ extern \"C\" \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u0442 C++ name mangling, \u0434\u0435\u043b\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u0438\u0434\u0438\u043c\u044b\u043c\u0438 \u0434\u043b\u044f C FFI extern \"C\" {     API double calculate_distance(Point3D* p1, Point3D* p2) {         \/\/ \u041a\u0430\u0441\u0442\u0443\u0435\u043c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u043a C++ \u0442\u0438\u043f\u0430\u043c \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c C++ \u043a\u043e\u0434         auto* point1 = reinterpret_cast&lt;geometry::Point3D*&gt;(p1);         auto* point2 = reinterpret_cast&lt;geometry::Point3D*&gt;(p2);         return geometry::distance(*point1, *point2);     } } <\/code><\/pre>\n<p>Build hook \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c C++ \u0444\u0430\u0439\u043b\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>g++<\/code> \u0438\u043b\u0438 <code>clang++<\/code>.<\/p>\n<h4>\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f<\/h4>\n<h3>Benchmarking Native Assets<\/h3>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 <code>package:benchmark_harness<\/code> \u0434\u043b\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 Dart \u0438 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<pre><code class=\"dart\">\/\/ benchmark\/performance_test.dart import 'package:benchmark_harness\/benchmark_harness.dart'; import 'package:my_native_package\/my_native_package.dart'; \/\/ \u041d\u0430\u0448 \u043f\u0430\u043a\u0435\u0442  \/\/ Benchmark \u0434\u043b\u044f \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 class NativeBenchmark extends BenchmarkBase {   NativeBenchmark() : super('MatrixMultiplication.Native');   @override   void run() =&gt; nativeMatrixMultiply(); \/\/ \u0432\u044b\u0437\u043e\u0432 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 }  \/\/ Benchmark \u0434\u043b\u044f Dart-\u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 class DartBenchmark extends BenchmarkBase {   DartBenchmark() : super('MatrixMultiplication.Dart');   @override   void run() =&gt; dartMatrixMultiply(); \/\/ \u0432\u044b\u0437\u043e\u0432 Dart-\u0444\u0443\u043d\u043a\u0446\u0438\u0438 }  void main() {   NativeBenchmark().report();   DartBenchmark().report(); } <\/code><\/pre>\n<h3>\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f Build Hooks<\/h3>\n<p>\u0414\u043b\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u0438 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430:<\/p>\n<ul>\n<li>\n<p><strong>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0444\u043b\u0430\u0433\u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438:<\/strong> \u0412 <code>hook\/build.dart<\/code> \u0434\u043b\u044f \u0440\u0435\u043b\u0438\u0437\u043d\u044b\u0445 \u0441\u0431\u043e\u0440\u043e\u043a \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0439\u0442\u0435 \u0444\u043b\u0430\u0433\u0438 <code>-O3<\/code> (\u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f) \u0438 <code>-flto<\/code> (Link Time Optimization).<\/p>\n<\/li>\n<li>\n<p><strong>\u041a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435:<\/strong> \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0439\u0442\u0435 \u0432 build hook \u043b\u043e\u0433\u0438\u043a\u0443 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0438\u0441\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0443\u0436\u0435 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u044b \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u043e-\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0435 \u0444\u043b\u0430\u0433\u0438:<\/strong> \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0444\u043b\u0430\u0433\u0438, \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <code>-march=native<\/code>.<\/p>\n<\/li>\n<li>\n<p> <strong>\u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435<\/strong> <code>assetName<\/code> \u0432 <code>CBuilder.library()<\/code> \u0432 \u0444\u0430\u0439\u043b\u0435 <code>hook\/build.dart<\/code>. \u041e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0442\u043e\u0447\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u0442\u043e\u0442 Dart-\u0444\u0430\u0439\u043b, \u0433\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f <code>@Native<\/code>. \u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 <code>@Native<\/code> \u0432 \u0444\u0430\u0439\u043b\u0435 <code>lib\/src\/bindings.dart<\/code>, \u0442\u043e \u0438 <code>assetName<\/code> \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c <code>'package:\u0438\u043c\u044f_\u043f\u0430\u043a\u0435\u0442\u0430\/src\/bindings.dart'<\/code>.  <\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"dart\">\/\/ hook\/build.dart  \/\/ \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0444\u043b\u0430\u0433\u043e\u0432 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 C List&lt;String&gt; _getOptimizedCFlags(BuildMode buildMode) {   if (buildMode == BuildMode.release) {     return ['-O3', '-DNDEBUG']; \/\/ \u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 assert'\u043e\u0432   }   return ['-g', '-DDEBUG']; \/\/ \u0424\u043b\u0430\u0433\u0438 \u0434\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438 }  \/\/ \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0444\u043b\u0430\u0433\u043e\u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a\u0430 List&lt;String&gt; _getOptimizedLdFlags(BuildMode buildMode) {   if (buildMode == BuildMode.release) {     return ['-flto']; \/\/ \u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u0438   }   return []; }  void main(List&lt;String&gt; args) async {   await build(args, (config, output) async {     final cbuilder = CBuilder.library(       name: 'my_optimized_lib',       assetName: 'package:my_package\/my_package.dart',       sources: ['src\/my_lib.c'],       \/\/ \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0444\u043b\u0430\u0433\u043e\u0432       cFlags: _getOptimizedCFlags(config.buildMode),       ldFlags: _getOptimizedLdFlags(config.buildMode),     );          await cbuilder.run(buildConfig: config, buildOutput: output);   }); }<\/code><\/pre>\n<h4>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h4>\n<p>Dart Native Assets \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u0440\u0435\u0432\u043e\u043b\u044e\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430. \u042d\u0442\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0440\u0435\u0448\u0430\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0438\u0441\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 FFI, \u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b\u043c, \u043c\u043e\u0449\u043d\u044b\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c.<\/p>\n<h3>\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/h3>\n<ul>\n<li>\n<p><strong>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f:<\/strong> \u041f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a.<\/p>\n<\/li>\n<li>\n<p><strong>\u041a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u043e\u0441\u0442\u044c:<\/strong> \u0415\u0434\u0438\u043d\u044b\u0439 build-\u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u043f\u043e\u0434 \u0432\u0441\u0435 \u0446\u0435\u043b\u0435\u0432\u044b\u0435 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b (\u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0435, \u0434\u0435\u0441\u043a\u0442\u043e\u043f\u043d\u044b\u0435).<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c:<\/strong> \u041f\u0440\u044f\u043c\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0431\u0435\u0437 \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u0445 \u0440\u0430\u0441\u0445\u043e\u0434\u043e\u0432, \u043f\u0440\u0438\u0441\u0443\u0449\u0438\u0445 Method Channels.<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u0440\u043e\u0441\u0442\u043e\u0442\u0430:<\/strong> \u0417\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0441 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c.<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0430 2025 \u0433\u043e\u0434 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 Native Assets \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0440\u0435\u043b\u043e\u0439 \u0438 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0437\u0430\u0434\u0430\u0447, \u0442\u0440\u0435\u0431\u0443\u044e\u0449\u0438\u0445 \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438\u043b\u0438 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0441 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 C\/C++\/Rust \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u043c\u0438 \u0432 \u044d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u0435 Dart \u0438 Flutter.<\/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\/918528\/\"> https:\/\/habr.com\/ru\/articles\/918528\/<\/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<h4>\u0414\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u043b\u0435\u043d\u0438\u044f:<\/h4>\n<ul>\n<li>\n<p>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 Native Assets &#8212; \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432<\/p>\n<\/li>\n<li>\n<p>\u0418\u0441\u0442\u043e\u0440\u0438\u044f \u0438 \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u044f<\/p>\n<\/li>\n<li>\n<p>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u044b<\/p>\n<\/li>\n<li>\n<p>Build Hooks &#8212; \u0441\u0435\u0440\u0434\u0446\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u0435 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>\u041b\u0443\u0447\u0448\u0438\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438<\/p>\n<\/li>\n<li>\n<p>Troubleshooting \u0438 \u043e\u0442\u043b\u0430\u0434\u043a\u0430<\/p>\n<\/li>\n<li>\n<p>\u042d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0438 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0435 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u0435<\/p>\n<\/li>\n<li>\n<p>\u0420\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u043a\u0435\u0439\u0441\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f<\/p>\n<\/li>\n<\/ul>\n<h4>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 Native Assets &#8212; \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432<\/h4>\n<h3>\u041f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438<\/h3>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435, \u0447\u0442\u043e \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c Dart-\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430, \u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u0443\u044e \u043d\u0430 C, C++, Rust \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u043e\u043c \u044f\u0437\u044b\u043a\u0435. \u0420\u0430\u043d\u044c\u0448\u0435 \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0441\u043b\u043e\u0436\u043d\u043e &#8212; \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443, \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u0442\u0435\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u043f\u043e\u043f\u0430\u043b\u0430 \u0432 \u043d\u0443\u0436\u043d\u043e\u0435 \u043c\u0435\u0441\u0442\u043e, \u0438 \u043f\u0438\u0441\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430.<\/p>\n<p>Native Assets &#8212; \u044d\u0442\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0432\u0435\u0441\u044c \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441. \u041e\u043d\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0430\u0448\u0435\u043c\u0443 Dart-\u043f\u0430\u043a\u0435\u0442\u0443 &#171;\u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0432 \u0441\u0435\u0431\u044f&#187; \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043a\u043e\u0434 \u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0435\u0433\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c.<\/p>\n<h3>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u044f \u0438\u0437 \u0436\u0438\u0437\u043d\u0438<\/h3>\n<p>\u042d\u0442\u043e \u043a\u0430\u043a \u0437\u0430\u043a\u0430\u0437 \u0435\u0434\u044b \u0441 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u043e\u0439:<\/p>\n<ul>\n<li>\n<p><strong>\u0420\u0430\u043d\u044c\u0448\u0435:<\/strong> \u0412\u044b \u0441\u0430\u043c\u0438 \u043f\u043e\u043a\u0443\u043f\u0430\u043b\u0438 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u044b, \u0433\u043e\u0442\u043e\u0432\u0438\u043b\u0438, \u043c\u044b\u043b\u0438 \u043f\u043e\u0441\u0443\u0434\u0443.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421 Native Assets:<\/strong> \u0412\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0435 &#171;\u0445\u043e\u0447\u0443 \u043f\u0438\u0446\u0446\u0443&#187;, \u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0441\u0430\u043c\u0430 \u0437\u0430\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438 \u0434\u0430\u0436\u0435 \u0443\u0431\u0438\u0440\u0430\u0435\u0442 \u0437\u0430 \u0441\u043e\u0431\u043e\u0439.<\/p>\n<\/li>\n<\/ul>\n<h3>\u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435<\/h3>\n<p>Native Assets \u2014 \u044d\u0442\u043e \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0432 Dart, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0430\u043a\u0435\u0442\u0430\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e Dart-\u043a\u043e\u0434, \u043d\u043e \u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u044f\u0437\u044b\u043a\u0430\u0445 (C, C++, Rust \u0438 \u0434\u0440.). \u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0431\u043e\u0440\u043a\u043e\u0439 \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0432 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 (<code>.so<\/code>, <code>.dll<\/code>, <code>.dylib<\/code>), \u0438\u0445 \u0443\u043f\u0430\u043a\u043e\u0432\u043a\u043e\u0439 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043d\u0438\u043c \u0438\u0437 Dart-\u043a\u043e\u0434\u0430 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 FFI (Foreign Function Interface).<\/p>\n<h4>\u0418\u0441\u0442\u043e\u0440\u0438\u044f \u0438 \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u044f<\/h4>\n<h3>\u0414\u043e Native Assets (\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0430)<\/h3>\n<p>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0445\u043e\u0447\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c C-\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443:<\/p>\n<ol>\n<li>\n<p>\u0412\u0440\u0443\u0447\u043d\u0443\u044e \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b.<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043f\u0438\u0440\u0443\u0435\u0442 <code>.so<\/code>\/<code>.dll<\/code>\/<code>.dylib<\/code> \u0444\u0430\u0439\u043b\u044b \u0432 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0441\u0442\u0430.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0438\u0448\u0435\u0442 FFI-\u0431\u0438\u043d\u0434\u0438\u043d\u0433\u0438.<\/p>\n<\/li>\n<li>\n<p>\u041c\u043e\u043b\u0438\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442 \u0432\u0441\u0435 \u044d\u0442\u043e \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438.<\/p>\n<\/li>\n<\/ol>\n<h3>\u0421 Native Assets (\u0441\u0432\u0435\u0442\u043b\u043e\u0435 \u0431\u0443\u0434\u0443\u0449\u0435\u0435)<\/h3>\n<p>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0445\u043e\u0447\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c C-\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443:<\/p>\n<ol>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u0432 <code>pubspec.yaml<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u041e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u0431\u043e\u0440\u043a\u0438 \u0432 <code>hook\/build.dart<\/code> (\u043e\u0434\u0438\u043d \u0440\u0430\u0437).<\/p>\n<\/li>\n<li>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0441\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442 \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442.<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432\u0435\u0437\u0434\u0435 &#171;\u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438&#187;.<\/p>\n<\/li>\n<\/ol>\n<h3>Timeline \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044f<\/h3>\n<ul>\n<li>\n<p><strong>Dart 3.2:<\/strong> \u041f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043f\u0435\u0440\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f Native Assets \u0437\u0430 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u043c \u0444\u043b\u0430\u0433\u043e\u043c <code>--enable-experiment=native-assets<\/code>.<\/p>\n<\/li>\n<li>\n<p><strong>Dart 3.4 (\u041c\u0430\u0439 2024):<\/strong> <strong>\u0421\u0442\u0430\u0431\u0438\u043b\u0438\u0437\u0430\u0446\u0438\u044f Native Assets.<\/strong> \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u0442\u0430\u043b\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0444\u043b\u0430\u0433 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f.<\/p>\n<\/li>\n<li>\n<p><strong>Flutter 3.22 (\u041c\u0430\u0439 2024):<\/strong> <strong>\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f Native Assets \u0432\u043e Flutter.<\/strong> \u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u0441\u0442\u0430\u043b\u0430 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0430 \u0432\u0441\u0435\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430\u0445.<\/p>\n<\/li>\n<\/ul>\n<h4>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u044b<\/h4>\n<pre><code class=\"coffeescript\">\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510    \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510    \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u2502   Dart Package  \u2502\u2500\u2500\u2500\u25b6\u2502   Build Hooks   \u2502\u2500\u2500\u2500\u25b6\u2502  Native Assets  \u2502 \u2502                 \u2502    \u2502                 \u2502    \u2502                 \u2502 \u2502 - pubspec.yaml  \u2502    \u2502 - hook\/build.dart\u2502   \u2502 - .so\/.dll\/.dylib\u2502 \u2502 - lib\/*.dart    \u2502    \u2502                  \u2502   \u2502 - metadata.json \u2502 \u2502 - src\/*.c       \u2502    \u2502                  \u2502   \u2502                 \u2502 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518    \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518    \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 <\/code><\/pre>\n<ol>\n<li>\n<p><strong>Package Structure<\/strong> <\/p>\n<pre><code class=\"dart\">my_native_package\/ \u251c\u2500\u2500 pubspec.yaml          # \u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u043f\u0430\u043a\u0435\u0442\u0430 \u251c\u2500\u2500 lib\/ \u2502   \u2514\u2500\u2500 my_package.dart   # Dart API \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c \u251c\u2500\u2500 src\/ \u2502   \u251c\u2500\u2500 my_lib.c          # \u041d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u2502   \u2514\u2500\u2500 my_lib.h          # \u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u2514\u2500\u2500 hook\/     \u2514\u2500\u2500 build.dart        # \u0421\u043a\u0440\u0438\u043f\u0442-\u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u0441\u0431\u043e\u0440\u043a\u0435 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 <\/code><\/pre>\n<\/li>\n<li>\n<p><strong>Build System Flow<\/strong> <\/p>\n<ol>\n<li>\n<p><code>dart pub get<\/code> \u0438\u043b\u0438 <code>flutter build<\/code> \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 <code>hook\/build.dart<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u044d\u0442\u043e\u0442 \u0441\u043a\u0440\u0438\u043f\u0442 (build hook) \u0432 \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b.<\/p>\n<\/li>\n<li>\n<p>Hook \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043a\u043e\u0434, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u044b (GCC, Clang, MSVC) \u0438\u043b\u0438 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b (Cargo, CMake).<\/p>\n<\/li>\n<li>\n<p>Hook \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 \u0430\u0441\u0441\u0435\u0442\u0430\u0445 (\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u0445).<\/p>\n<\/li>\n<li>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u0441\u0431\u043e\u0440\u043a\u0438 \u0443\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u044d\u0442\u0438 \u0430\u0441\u0441\u0435\u0442\u044b \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c.<\/p>\n<\/li>\n<li>\n<p>Dart-\u043a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c FFI \u0434\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u0430 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438.<\/p>\n<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<h4>Build Hooks &#8212; \u0441\u0435\u0440\u0434\u0446\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b<\/h4>\n<h3>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 Build Hook<\/h3>\n<p>Build Hook \u2014 \u044d\u0442\u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 Dart-\u0441\u043a\u0440\u0438\u043f\u0442 (<code>hook\/build.dart<\/code>), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0441\u0431\u043e\u0440\u043a\u0438:<\/p>\n<ul>\n<li>\n<p>\u041a\u0430\u043a\u043e\u0439 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043a\u043e\u0434 \u043d\u0443\u0436\u043d\u043e \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u043a \u0438\u043c\u0435\u043d\u043d\u043e \u0435\u0433\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c (\u043a\u0430\u043a\u0438\u0435 \u0444\u043b\u0430\u0433\u0438, \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438).<\/p>\n<\/li>\n<li>\n<p>\u0413\u0434\u0435 \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<\/li>\n<\/ul>\n<h3>\u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 hook\/build.dart (\u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438)<\/h3>\n<p><strong>\u0412\u0430\u0436\u043d\u043e:<\/strong> \u042d\u0442\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043f\u0440\u044f\u043c\u043e\u0439 \u0432\u044b\u0437\u043e\u0432 <code>gcc<\/code> \u0438 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u044b\u043c. \u041e\u043d \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430. \u0412 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u043e\u0431\u0435\u0440\u0442\u043a\u0438, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a <code>native_toolchain_c<\/code>.<\/p>\n<pre><code class=\"dart\">\/\/ hook\/build.dart import 'package:native_assets_cli\/native_assets_cli.dart'; import 'dart:io';  void main(List&lt;String&gt; args) async {   await build(args, (config, output) async {     \/\/ \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c, \u0447\u0442\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c     final packageName = config.packageName;     final sourceFile = config.packageRoot.resolve('src\/my_lib.c');     final outDir = config.outputDirectory;      \/\/ \u0418\u043c\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b     String libName;     if (config.targetOS == OS.windows) {       libName = 'my_lib.dll';     } else if (config.targetOS == OS.macOS) {       libName = 'libmy_lib.dylib';     } else {       libName = 'libmy_lib.so';     }     final outFile = outDir.resolve(libName);      \/\/ \u041a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c C \u043a\u043e\u0434 \u0432 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443     final result = await Process.run(       'gcc',       [         '-shared',         '-fPIC',         '-o',         outFile.toFilePath(),         sourceFile.toFilePath(),       ],     );      if (result.exitCode != 0) {       throw Exception('Compilation failed: ${result.stderr}');     }      \/\/ \u0421\u043e\u043e\u0431\u0449\u0430\u0435\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435     output.addAsset(NativeCodeAsset(       package: packageName,       name: 'src\/my_lib.c', \/\/ \u0418\u043c\u044f \u0430\u0441\u0441\u0435\u0442\u0430 \u0434\u043e\u043b\u0436\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043f\u0443\u0442\u0438 \u043a \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0443       file: outFile,       linkMode: LinkMode.dynamic,       os: config.targetOS,       architecture: config.targetArchitecture,     ));   }); } <\/code><\/pre>\n<h3>\u041f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u0439 \u0438 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 native_toolchain_c<\/h3>\n<p>\u042d\u0442\u043e\u0442 \u043f\u0430\u043a\u0435\u0442 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 <code>CBuilder<\/code> \u0434\u043b\u044f \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438.<\/p>\n<pre><code class=\"dart\">\/\/ hook\/build.dart import 'package:native_assets_cli\/native_assets_cli.dart'; import 'package:native_toolchain_c\/native_toolchain_c.dart';  void main(List&lt;String&gt; args) async {   await build(args, (config, output) async {     final cbuilder = CBuilder.library(       name: 'my_complex_lib',       assetName: 'path\/to\/my_lib.dart', \/\/ \u041f\u0443\u0442\u044c \u043a Dart \u0444\u0430\u0439\u043b\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443       sources: [         'src\/core.c',         'src\/utils.c',       ],       includes: [         'src\/include\/',       ],       defines: {         'VERSION': '1.0.0',         'DEBUG': config.buildMode == BuildMode.debug ? '1' : '0',       },     );      await cbuilder.run(       buildConfig: config,       buildOutput: output,       \/\/ \u0414\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043b\u043e\u0433\u0433\u0435\u0440       \/\/ logger: Logger()..level = Level.all,     );   }); } <\/code><\/pre>\n<h4>\u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b<\/h4>\n<h3>\u041f\u0440\u0438\u043c\u0435\u0440 1: \u041f\u0440\u043e\u0441\u0442\u0430\u044f \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430<\/h3>\n<p><strong>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/strong><\/p>\n<pre><code class=\"dart\">math_native\/ \u251c\u2500\u2500 pubspec.yaml \u251c\u2500\u2500 lib\/ \u2502   \u2514\u2500\u2500 math_native.dart \u251c\u2500\u2500 src\/ \u2502   \u251c\u2500\u2500 math_ops.c \u2502   \u2514\u2500\u2500 math_ops.h \u2514\u2500\u2500 hook\/     \u2514\u2500\u2500 build.dart <\/code><\/pre>\n<p><strong>C-\u043a\u043e\u0434 (<\/strong><code><strong>src\/math_ops.c<\/strong><\/code><strong>) <\/strong>(<strong>C<\/strong> \u043d\u0435\u0442 \u0432 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435 \u0445\u0430\u0431\u0440\u0430 \u0432 \u0432\u044b\u043f\u0430\u0434\u0430\u044e\u0449\u0435\u043c \u0441\u043f\u0438\u0441\u043a\u0435 \u044f\u0437\u044b\u043a\u043e\u0432, \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b \u0421++)<\/p>\n<pre><code class=\"cpp\">\/\/ src\/math_ops.c #include \"math_ops.h\"  \/\/ \u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0424\u0438\u0431\u043e\u043d\u0430\u0447\u0447\u0438 int fibonacci(int n) {     if (n &lt;= 1) return n;     int a = 0, b = 1, c;     for (int i = 2; i &lt;= n; i++) {         c = a + b;         a = b;         b = c;     }     return b; } <\/code><\/pre>\n<p><strong>\u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u044b\u0439 \u0444\u0430\u0439\u043b (<\/strong><code><strong>src\/math_ops.h<\/strong><\/code><strong>)<\/strong><\/p>\n<pre><code class=\"cpp\">\/\/ src\/math_ops.h #ifndef MATH_OPS_H #define MATH_OPS_H  \/\/ Dart FFI \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u044f\u0432\u043d\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0434\u043b\u044f Windows #if defined(_WIN32) #define API __declspec(dllexport) #else #define API #endif  API int fibonacci(int n);  #endif <\/code><\/pre>\n<p><strong>Build Hook (<\/strong><code><strong>hook\/build.dart<\/strong><\/code><strong>)<\/strong><\/p>\n<pre><code class=\"cpp\">\/\/ hook\/build.dart \/\/ \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u043a\u0435\u0442 native_toolchain_rust import 'package.native_assets_cli\/native_assets_cli.dart'; import 'package.native_toolchain_rust\/native_toolchain_rust.dart';  void main(List&lt;String&gt; args) async {   await build(args, (config, output) async {     \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0431\u043e\u0440\u0449\u0438\u043a \u0434\u043b\u044f Rust-\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438     final rustBuilder = RustBuilder.library(       name: 'string_processor', \/\/ \u0418\u043c\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0430\u043a\u0435\u0442\u0430 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 Cargo.toml       \/\/ \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c Dart-\u0444\u0430\u0439\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0443 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443       assetName: 'package:\u0438\u043c\u044f_\u0432\u0430\u0448\u0435\u0433\u043e_\u043f\u0430\u043a\u0435\u0442\u0430\/\u0438\u043c\u044f_dart_\u0444\u0430\u0439\u043b\u0430.dart',     );      \/\/ \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u0431\u043e\u0440\u043a\u0443     await rustBuilder.run(       buildConfig: config,       buildOutput: output,     );   }); }<\/code><\/pre>\n<p><strong>Dart API (<\/strong><code><strong>lib\/math_native.dart<\/strong><\/code><strong>)<\/strong><\/p>\n<pre><code class=\"cpp\">\/\/ lib\/math_native.dart import 'dart:ffi';  \/\/ \u0410\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f @Native \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 FFI \u043d\u0430 \u0438\u043c\u044f \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \/\/ \u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u0441\u0431\u043e\u0440\u043a\u0438 Native Assets \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0430\u0439\u0434\u0435\u0442 \u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442 \/\/ \u043d\u0443\u0436\u043d\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443, \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0434\u043b\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b. @Native&lt;Int32 Function(Int32)&gt;('fibonacci') external int _fibonacci(int n);  \/\/\/ \u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0447\u0438\u0441\u043b\u0430 \u0424\u0438\u0431\u043e\u043d\u0430\u0447\u0447\u0438 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. int fibonacci(int n) =&gt; _fibonacci(n); <\/code><\/pre>\n<p><code><strong>pubspec.yaml<\/strong><\/code><\/p>\n<pre><code class=\"yaml\">name: math_native description: Fast native math operations. version: 1.0.0 publish_to: 'none' # \u0414\u043b\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430  environment:   sdk: '&gt;=3.4.0 &lt;4.0.0'  dependencies:   ffi: ^2.1.0  # \u041f\u0430\u043a\u0435\u0442\u044b \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c, # Dart SDK \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0438\u0445 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438. # dev_dependencies: #   native_assets_cli: ... #   native_toolchain_c: ... <\/code><\/pre>\n<h3>\u041f\u0440\u0438\u043c\u0435\u0440 2: \u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0441 Rust<\/h3>\n<p><strong>Rust-\u043a\u043e\u0434 (<\/strong><code><strong>src\/<\/strong><\/code><a href=\"http:\/\/lib.rs\" rel=\"noopener noreferrer nofollow\"><code><strong>lib.rs<\/strong><\/code><\/a><strong>)<\/strong><\/p>\n<pre><code class=\"rust\">\/\/ src\/lib.rs use std::ffi::{CStr, CString}; use std::os::raw::c_char;  #[no_mangle] pub extern \"C\" fn process_string(input: *const c_char) -&gt; *mut c_char {     let c_str = unsafe { CStr::from_ptr(input) };     let rust_string = c_str.to_string_lossy();      \/\/ \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 Rust (\u0440\u0435\u0432\u0435\u0440\u0441 \u0438 \u0432\u0435\u0440\u0445\u043d\u0438\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440)     let processed = rust_string.chars().rev().collect::&lt;String&gt;().to_uppercase();      let c_string = CString::new(processed).unwrap();     c_string.into_raw() }  #[no_mangle] pub extern \"C\" fn free_string(ptr: *mut c_char) {     if !ptr.is_null() {         unsafe {             \/\/ \u0412\u043e\u0441\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c CString \u0438\u0437 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u0438 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u043c \u043f\u0430\u043c\u044f\u0442\u044c             let _ = CString::from_raw(ptr);         };     } } <\/code><\/pre>\n<p><code><strong>Cargo.toml<\/strong><\/code><\/p>\n<p>Ini, TOML (TOML \u043d\u0435\u0442 \u0432 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435 \u0445\u0430\u0431\u0440\u0430 \u0432 \u0432\u044b\u043f\u0430\u0434\u0430\u044e\u0449\u0435\u043c \u0441\u043f\u0438\u0441\u043a\u0435 \u044f\u0437\u044b\u043a\u043e\u0432)<\/p>\n<pre><code class=\"rust\">[package] name = \"string_processor\" version = \"0.1.0\" edition = \"2021\"  [lib] crate-type =<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-463477","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/463477","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=463477"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/463477\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=463477"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=463477"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=463477"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}