historyGo method
Goes jumps of delta
in the url history
Throws an exception if this is not possible Use historyCanGo to know if this is possible
Implementation
void historyGo(int delta) {
final vRouteInformation = _vRouterScope.vHistory.vRouteInformationAt(delta);
if (!Platform.isWeb) {
assert(vRouteInformation != null);
final newUri = Uri.parse(vRouteInformation!.url);
_updateUrl(
newUri,
newHistoryState: vRouteInformation.state,
newVRoute:
_getNewVRoute(uri: newUri, historyState: vRouteInformation.state),
onCancel: () {
VLogPrinter.show(
VStoppedNavigationTo(
vNavigationMethod: VNavigationMethod.vHistory,
url: newUri.toString(),
),
);
},
onUpdate: () {
VLogPrinter.show(
VSuccessfulNavigationTo(
vNavigationMethod: VNavigationMethod.vHistory,
url: newUri.toString(),
),
);
// If the navigation is successful, sync the vHistory
_vRouterScope.vHistory.go(delta);
},
);
} else {
BrowserHelpers.browserGo(delta);
}
}