LifecycleState enum

生命周期状态

Inheritance
Available extensions

Values

onInit → const LifecycleState

初始化,触发一次 如同 State.initState onInit:初始化状态,单场景调用 BuildContext 在初始化时期不可用

onCreate → const LifecycleState

创建,触发一次 如同 WidgetsBinding.instance.addPostFrameCallback onCreate:widget 完成创建,完成首帧绘制,单场景调用

onStart → const LifecycleState

开始执行,可能触发多次 onStart:widget 开始执行,多场景调用, 与 #onStop 成对

onResume → const LifecycleState

恢复执行,重新回到可执行状态,可能触发多次 onResume:widget 恢复执行,在widget重新回到用户视野/回到前台获取焦点时调用,多场景调用,与 #onPause 成对

onPause → const LifecycleState

挂起/暂停执行,可能执行多次 onPause:widget 挂起执行,在widget失去焦点/进入后台/被系统或自定义的非全屏弹窗遮挡时调用,多场景调用,与 #onResume 成对

onStop → const LifecycleState

停止执行,可能执行多次 onStop:widget 停止执行,在widget完全离开用户视野/进入后台/被系统或自定义的全屏弹窗遮挡时调用,多场景调用,与 #onStart 成对

onDestroy → const LifecycleState

销毁,执行一次 如同 State.dispose onDestroy:widget 销毁,页面销毁/退出程序时调用,单场景调用

Properties

hashCode int
The hash code for this object.
no setterinherited
index int
A numeric identifier for the enumerated value.
no setterinherited
name String

Available on Enum, provided by the EnumName extension

The name of the enum value.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

values → const List<LifecycleState>
A constant List of the values in this enum, in order of their declaration.