ClassSwitcher class

课堂自动切换协调器(单例)。

职责骨架:监听 classEnd → 判定 → 软销毁当前 → 加入下一节 → 发出生命周期回调。具体业务逻辑由 Task 4 / Task 7 落地。

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
status → Rx<ClassSwitchStatus>
final

Methods

bindEnv(ClassSwitchEnv env) → void
在 TCICController 初始化期绑定环境查询 adapter。
bindNativeBridge(ClassSwitchNativeBridge? bridge) → void
注入 Native 桥接器;传 null 解绑(主要给测试清理)。
cancel() Future<void>
取消进行中的切换。当前等待中的 retry delay 会在唤醒后自检并落 failed。 已发起的 performSwitchTo 不会被中断。
handleClassEnd(Object? event) Future<bool>
切换入口:preparing → switching → (retrying)* → idle / failed。
handleClassEndIfNeeded(Object? event) Future<bool>
若当前 classEnd 应由 ClassSwitcher 接管,则执行切换并返回 true。 否则返回 false,调用方继续原有结束课堂流程。
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset() → void
重置为初始 idle 状态。测试与业务兜底均可调用。
toString() String
A string representation of this object.
inherited
unbindEnv() → void
解绑(主要用于测试;生产场景在 TCICController.dispose 时调用)。
willHandleClassEnd() bool
判断是否应由 ClassSwitcher 接管此次 classEnd。

Operators

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

Static Properties

instance ClassSwitcher
final
retryDelay Duration
重试间隔。生产默认 2s;测试可重写为更小值加速。
getter/setter pair

Constants

maxRetry → const int
最大重试次数(不含首次尝试)。