build method

Widget build(
  1. BuildContext context
)

Builds the widget for this route.

If builder is provided, retrieves arguments via ModalRoute.of(context)?.settings.arguments and invokes the builder. Otherwise, returns the static widget, or an empty box if neither is set.

Implementation

Widget build(BuildContext context) {
  if (builder != null) {
    final args = ModalRoute.of(context)!.settings.arguments;
    return builder!(context, args);
  } else if (widget != null) {
    return widget!;
  } else {
    return const SizedBox.shrink();
  }
}