createViewModel<T extends ViewModel> method

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

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.

Implementation

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