createViewModel<T extends ViewModel> method

ViewModel createViewModel<T extends ViewModel>(
  1. Object parameter

Creates a view model of a specified type.

The parameter is a value that will be passed to the new viewmodel's init method. This method is usefule for creating a view model to pass to an apps starting widget.


ViewModel createViewModel<T extends ViewModel>(Object parameter) {
  ViewModel _viewModel = Core.componentResolver.resolveType<T>();
  return _viewModel;