在flutter_html_editor中使用TextEditingController

时间:2020-06-07 14:21:31

标签: html flutter editor

有什么方法可以直接从TextField将String值保存到控制器(TextEditingController)中,而无需在此插件https://pub.dev/packages/flutter_html_editor中使用keyEditor.currentState.getText()

我需要使用控制器,因为有时使用此控制器时会得到 null 值:

final txt = await keyEditor.currentState.getText();

如何避免空值。如果我这样添加它会很好:

HtmlEditor(
                controller: comment_control,
                hint: "Your text here...",
                //value: "text content initial, if any",
                key: keyEditor,

                height: 400,
              ),

谢谢

0 个答案:

没有答案