rebuild<T extends StatefulWidget> static method
void
rebuild<
T extends StatefulWidget>( - BuildContext? context,
- void fn(
- 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);
}