maybeOf static method

ExpansionTileController? maybeOf(
  1. BuildContext context
)

Finds the ExpansionTile from the closest instance of this class that encloses the given context and returns its ExpansionTileController.

If no ExpansionTile encloses the given context then return null. To throw an exception instead, use of instead of this function.

See also:

  • of, a similar function to this one that throws if no ExpansionTile encloses the given context. Also includes some sample code in its documentation.

Implementation

static ExpansionTileController? maybeOf(BuildContext context) {
  return context.findAncestorStateOfType<_ExpansionTileState>()?._tileController;
}