未验证 提交 5cef4a02 编写于 作者: G Gary Qian 提交者: GitHub

Use final state passed to dart before initialization as the initial lifecycleState. (#8124)

上级 ffef51be
......@@ -92,7 +92,10 @@ void _updateUserSettingsData(String jsonData) {
@pragma('vm:entry-point')
// ignore: unused_element
void _updateLifecycleState(String state) {
window._initialLifecycleState ??= state;
// We do not update the state if the state has already been used to initialize
// the lifecycleState.
if (!window._initialLifecycleStateAccessed)
window._initialLifecycleState = state;
}
......
......@@ -562,8 +562,15 @@ class Window {
///
/// It is used to initialize [SchedulerBinding.lifecycleState] at startup
/// with any buffered lifecycle state events.
String get initialLifecycleState => _initialLifecycleState;
String get initialLifecycleState {
_initialLifecycleStateAccessed = true;
return _initialLifecycleState;
}
String _initialLifecycleState;
/// Tracks if the initial state has been accessed. Once accessed, we
/// will stop updating the [initialLifecycleState], as it is not the
/// preferred way to access the state.
bool _initialLifecycleStateAccessed = false;
/// The system-reported text scale.
///
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册