getWidget method

Widget getWidget(
  1. BuildContext context, {
  2. dynamic forceInit = false,
  3. dynamic args,
})

Returns current Widget or tries to initialize new one. forceInit to re-init widget.

Implementation

Widget getWidget(BuildContext context, {forceInit = false, dynamic args}) {
  if (forceInit || parent != context || _widget == null || !isValid()) {
    parent = context;
    _widget = initWidget(context, args: args);
  }

  return _widget!;
}