collapse method

void collapse()

Collapses the ExpansionTile that was built with this controller.

Normally the tile is collapsed automatically when the user taps on the header. It can be useful sometimes to trigger the collapse programmatically due to some external changes.

If the tile is already in the collapsed state (see isExpanded), calling this method has no effect.

Calling this method may cause the ExpansionTile to rebuild, so it may not be called from a build method.

Calling this method will trigger an ExpansionTile.onExpansionChanged callback.

See also:

Implementation

void collapse() {
  assert(_state != null);
  if (isExpanded) {
    _state!._toggleExpansion();
  }
}