context property

BuildContext get context

returns the navigator context

Be-aware build context can be null if the navigator is not yet mounted this happens if you're guarding the first route in the app

Implementation

BuildContext get context {
  final context = _router.globalRouterKey.currentContext;
  assert(context != null, 'Router is not mounted');
  return context!;
}