我找不到任何具体资源,Dart是否已编译为JVM,还是Google的团队将Dart VM编译为在JVM上运行,然后在JVM内的Dart VM中运行Dart?
前者更有意义,并且与“ no bridge”的口头禅相呼应,但后者似乎更符合how integration between native & flutter code looks like的要求.
解决方法:
Dart被编译为本机代码(ARM,Intel等)可执行文件,并与某些本机平台代码(Java,Kotlin,Objective-C / Swift)捆绑在一起,以与本机平台进行交互.
也可以看看
How does Flutter run my code on Android? The engine’s C and C++ code
are compiled with Android’s NDK. The Dart code (both the SDK’s and
yours) are ahead-of-time (AOT) compiled into a native, ARM library.
That library is included in a “runner” Android project, and the whole
thing is built into an APK. When launched, the app loads the Flutter
library. Any rendering, input or event handling, and so on, are
delegated to the compiled Flutter and app code. This is similar to the
way many game engines work.Debug mode builds use a virtual machine (VM) to run Dart code (hence
the “debug” banner they show to remind people that they’re slightly
slower) in order to enable stateful hot reload.How does Flutter run my code on iOS? The engine’s C and C++ code are
compiled with LLVM. The Dart code (both the SDK’s and yours) are
ahead-of-time (AOT) compiled into a native, ARM library. That library
is included in a “runner” iOS project, and the whole thing is built
into an .ipa. When launched, the app loads the Flutter library. Any
rendering, input or event handling, and so on, are delegated to the
compiled Flutter and app code. This is similar to the way many game
engines work.Debug mode builds use a virtual machine (VM) to run Dart code (hence
the “debug” banner they show to remind people that they’re slightly
slower) in order to enable stateful hot reload.
https://flutter.io/docs/resources/faq#how-does-flutter-run-my-code-on-android
另请参见https://proandroiddev.com/flutters-compilation-patterns-24e139d14177
原文地址:https://codeday.me/bug/20191108/2006838.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。