简体   繁体   English

如何从 Flutter web 调用原生 Android 代码?

[英]How to Call Native Android Code from Flutter web.?

I need to know is there any way to call platform specific code from flutter web.我需要知道有什么方法可以从 flutter web 调用平台特定代码。

basically I've android SDK integrated in the flutter project I'm successfully able to communicate with the SDK using the Method Channel from the APK generated from the project but when I run the project in flutter web project is unable to communicate with the SDK. basically I've android SDK integrated in the flutter project I'm successfully able to communicate with the SDK using the Method Channel from the APK generated from the project but when I run the project in flutter web project is unable to communicate with the SDK.

You don't call native mobile code from Flutter Web您不会从 Flutter Web 调用本机移动代码

Flutter on the Web is for Flutter apps running in a browser. Web 上的 Flutter适用于在浏览器中运行的 Flutter 应用程序。 Browser sites/apps are isolated from the full operating system.浏览器站点/应用程序与整个操作系统隔离。

The browsers have their own its own evolving JavaScript APIs, see: https://caniuse.com/ for what is possible depending on browser app/version.浏览器有自己不断发展的 JavaScript API,请参阅: https://caniuse.com/了解可能的情况,具体取决于浏览器应用程序/版本。 For example note that device orientation has some support while other browsers support accelerometer fully .例如请注意,设备方向有一些支持,而其他浏览器完全支持加速度计

Flutter's platform channels allows for mobile developers to access mobile native APIs available to any installable mobile app (Android & iOS) or any additional native mobile libraries. Flutter 的平台通道允许移动开发人员访问可用于任何可安装移动应用(Android 和 iOS)或任何其他原生移动库的移动原生 API。 For example browsers have no native machine learning API while in a mobile app you can package MLKit with a Flutter plugin .例如,浏览器没有本地机器学习 API,而在移动应用程序中,您可以使用 package MLKit 和 Flutter 插件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM