getArgs<T> static method

T getArgs<T>(
  1. BuildContext context, {
  2. required String key,
})

getArgs Get the arguments from the current route

  • context The context to get the arguments
  • Param key The key to get the arguments
  • Example:
BaseNavigation.getArgs(context, key: 'id');

Implementation

static T getArgs<T>(BuildContext context, {required String key}) {
  return (ModalRoute.of(context)!.settings.arguments
      as Map<String, dynamic>)[key] as T;
}