Flutter-它在幕后如何运作? [英] Flutter - How does it work behind the scenes?

查看:58
本文介绍了Flutter-它在幕后如何运作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

显然,flutter是一个框架,用于使用一个代码库在iOSAndroid上运行应用程序.但是,它如何做到这一点呢?它会编译为本地代码,还是在过程中涉及中级语言或VM?我尝试在Github上阅读一些源代码,但找不到任何东西.

Obviously, flutter is a framework for running apps on iOS and Android using one codebase. But how does it manage to do so? Will it compile to native code, or is there a mid level language or a VM involved in the process? I tried reading some of the source code on Github, but I couldn't find anything.

推荐答案

使用Dart的AoT编译功能将Dart源代码编译为本机代码.虽然它仍然需要Dart VM的某些部分(某些运行时组件,如垃圾收集)才能运行,但是由于iOS不允许动态编译,因此代码会提前编译为本地代码.

The Dart source code is compiled to native code using Dart's AoT compilation feature. It still needs parts of the the Dart VM (some runtime components like garbage collection) to run though, but the code is compiled to native code ahead of time, because iOS doesn't allow dynamic compilation.

Flutter还可以调出Android并使用仅在Java中可用的Android功能(与iOS相同). Flutter支持构建自定义插件(除了提供的插件之外),以调出本机平台代码.

Flutter can also call out to Android and use Android features only available in Java (same with iOS). Flutter supports to build custom plugins (in addition to a lot of provided ones) to call out to native platform code.

这篇关于Flutter-它在幕后如何运作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆