- 创建GlobalKey变量
 
GlobalKey<HtmlEditorState> keyTitle = GlobalKey();
- 创建子组件
 
class SonView extends StatefulWidget {final String value;final double height;SonView({Key key,this.value,this.height = 380,}): super(key: key);@overrideSonViewState createState() => SonViewState();}...
传入子组件
SonView(key: keyTitle)
使用子组件的方法和成员变量
// 确保子组件存在需要的成员变量和方法final height = await keyTitle.currentState.height; // 读取子组件成员变量final title = await keyTitle.currentState.getText(); // 调用子组件方法
