getArgs<T> static method

T? getArgs<T>(
  1. BuildContext context
)

Implementation

static T? getArgs<T>(BuildContext context) {
  try {
    Object? args = ModalRoute.of(context)?.settings.arguments;
    if (args is T) return args;
    return null;
  } catch (e) {
    throw RouteException(
        "Use getArgs in onReady state. Don't use in constructor or initState");
  }
}