flutter 声明周期相关 BuildOwner.finali
作者:
菜鸟何时起飞 | 来源:发表于
2022-03-13 12:32 被阅读0次1 WidgetsBinding.drawFrame 执行的时候 会 回调 BuildOwner.finalizeTree。
1.1 执行_inactiveElements._unmountAll()
1.1.1 设置_locked 为true。
1.1.2 _elements 排序放到 elements,_elements 清空。
1.1.3 遍历每一个elements 执行_unmount
1.2 执行_unmount,遍历执行每一个element的unmount
1.2.1 Element.unmount()
如果key是GlobalKey ,移出owner中的注册。
设置_dependencies =null ,_widget = null
设置_lifecycleState = _ElementLifecycle.defunct;
1.2.2 RenderObjectElement.unmount()
执行widget.didUnmountRenderObject()
执行_renderObject!.dispose();
设置_renderObject = null;
1.2.3 StatefulElement.unmount()
执行state.dispose();
执行 state._element = null;
执行_state = null;
本文标题:flutter 声明周期相关 BuildOwner.finali
本文链接:https://www.haomeiwen.com/subject/akokdrtx.html
网友评论