syncWithTextController method
将 Subject 与 TextEditingController 同步
controller
文本编辑控制器
Implementation
DisposeHandler syncWithTextController(TextEditingController controller) {
// 只在 Subject 未关闭时同步初始值
if (!isClosed) {
add(controller.text);
}
return syncWith(
controller,
add,
getValue: () => controller.text,
setValue: (value) => controller.text = value,
);
}