18

Beike AspectD 的原理及运用

 3 years ago
source link: https://www.infoq.cn/article/Udy0OLJQMNEyzklg5FQZ
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

AOP 为 Aspect Oriented Programming 的缩写,意为:面向切面编程,通过预编译方式和运行期间动态代理实现程序功能的统一维护的一种技术。

AspectD 是咸鱼针对 Flutter 实现的 AOP 开源库,GitHub 地址如下: https://github.com/alibaba-flutter/aspectd

十分感谢咸鱼团队开源的 AspectD 开源库,AspectD 让 flutter 具备了 aop 的能力,给了贝壳 flutter 团队很多思路,让很多想法成为可能。

2 Flutter 相关知识介绍

首先,我们来回顾一下 flutter 编译相关的一些知识。

2.1 Flutter 编译流程

2YNVJ3Z.png!mobile

如上图,flutter 在编译时,首先由编译前端将 dart 代码转换为中间文件 app.dill,然后在 debug 模式下,将 app.dill 转换为 kernel_blob.bin(其实这个文件就是 app.dill 改了个名字),在 release 模式下,app.dill 被转换为 framework 或者 so。

Flutter 的 aop 就是对 app.dill 进行修改实现的。下面我们先来了解一下 app.dill 文件。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK