rebuild<T extends StatefulWidget> static method

void rebuild<T extends StatefulWidget>(
  1. BuildContext? context,
  2. void fn(
    1. T widget
    )
)

Implementation

static void rebuild<T extends StatefulWidget>(BuildContext? context, void Function(T widget) fn) {
  assert(T != StatefulWidget, 'Type should be a subclass a StatefulWidget, but not a StatefulWidget type ${T == StatefulWidget}');
  T? widget = ElementsUtils.getWidgetOfType<T>(context);
  if (widget == null) {
    return;
  }
  fn(widget);
  ElementsUtils.rebuildWidget(context, widget);
}