Use final state passed to dart before initialization as the initial lifecycleState. (flutter/engine#8124)
This commit is contained in:
@@ -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.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user