args<T extends NyArgument?> static method

T? args<T extends NyArgument?>(
  1. BuildContext context
)

Retrieves the arguments passed in when calling the navigate function.

Returned arguments are casted with the type provided, the type will always be a subtype of NyArgument.

Make sure to provide the appropriate type, that is, provide the same type as the one passed while calling navigate, else a cast error will be thrown.

Implementation

static T? args<T extends NyArgument?>(BuildContext context) {
  return (ModalRoute.of(context)!.settings.arguments as ArgumentsWrapper)
      .baseArguments as T?;
}