【发布时间】:2020-04-26 00:51:58
【问题描述】:
class Astate extends State<A>
{
List b=new List<B>();
@override
Widget build(BuildContext context){
b.add(B());
//how do I access theMethod() for the state object for b[0]?
}
}
class B extends StatefulWidget
{
@override
Bstate createState() => Bstate();
}
class Bstate extends State<B>
{
theMethod()
{
//some content
}
@override
Widget build(BuildContext context) {
}
}
有没有办法使用 b[0] 从它的相应状态对象访问 theMethod() ? 如果没有,有没有其他方法可以达到同样的效果?
【问题讨论】:
标签: android inheritance flutter dart statefulwidget