flutter 的mounted

Whether this State object is currently in a tree.

After creating a State object and before calling initState, the framework "mounts" the State object by associating it with a BuildContext. The State object remains mounted until the framework calls dispose, after which time the framework will never ask the State object to build again.

It is an error to call setState unless mounted is true.

展开阅读全文

没有更多推荐了,返回首页