maybeOf static method
从此类的最接近的实例中查找 TxExpansionPanel,该实例包含给定上下文并返回其 TxExpansionPanelController。
如果没有 TxExpansionPanel 包含给定的上下文,则返回 null。若要改为引发异常,请使用 of 而不是此函数。
另请参阅:
- of,一个与此函数类似的函数,如果没有 TxExpansionPanel 包含给定的上下文,则抛出 该函数。在其文档中还包括一些示例代码。
Implementation
static TxExpansionPanelController? maybeOf(BuildContext context) {
return context
.findAncestorStateOfType<_ExpansionTileState>()
?._tileController;
}