navigate<V extends ViewModel> method

Future navigate<V extends ViewModel>(
  1. {Object parameter}
)
override

Navigates to a new viewmodel of the type specified by the generic.

The parameter is a value that will be passed to the new viewmodel's init method.

Implementation

Future navigate<V extends ViewModel>({Object parameter}) async {
  var _viewModel = createViewModel<V>(parameter);

  var routeName = Core._viewLocator.getViewFromViewModelType<V>();

  await Navigator.of(_viewContext)
      .pushNamed(routeName, arguments: _viewModel);

  _viewModel.dispose();
}