handle method
Implementation
@override
//ignore: avoid_renaming_method_parameters
void handle(NavigationCommand command) {
if (command is NavigateBackCommand || command is NavigateBackToCommand) {
if (_canPop()) {
navigator.back();
print('OnNavigatedBackEvent(fallbackPath: NULL)');
Buzz.fire(OnNavigatedBackEvent());
return;
}
String fallback = backDefault;
if (command is NavigateBackCommand) {
fallback = command.preferredBackDefault ?? backDefault;
} else if (command is NavigateBackToCommand) {
fallback = command.directions.routeBuilder();
}
navigator.offAndToNamed(fallback);
print('OnNavigatedBackEvent(fallbackPath: $fallback)');
Buzz.fire(OnNavigatedBackEvent(fallbackPath: fallback));
}
if (command is NavigateToCommand) {
final path = command.directions.routeBuilder();
navigator.toNamed(path);
Buzz.fire(OnNavigatedToEvent(path));
}
}