initialize method

void initialize(
  1. {Registrations registrations}
)

Called to initialize the fmvvm framework.

This should be done before attempting to use any fmvvm components, usually during the app startup. The registrations parameter allows overrides of the devault navigation, view location and component resolution (dependency injection/Ioc) implementations.

Implementation

static void initialize({Registrations registrations}) {
  var startRegistrations = registrations ?? Registrations();

  _navigationService = startRegistrations.getNavigationService();
  _viewLocator = startRegistrations.getViewLocator();
  _componentResolver = startRegistrations.getResolver();
  _messageService = startRegistrations.getMessageService();

  _componentResolver.registerInstance<ViewLocator>(_viewLocator);
  _componentResolver.registerInstance<NavigationService>(_navigationService);
  _componentResolver.registerInstance<MessageService>(_messageService);

  _navigationService.initialize();
}