reloadCurrentPage method

void reloadCurrentPage()

Remakes the request to the current page and updates its content. It only works if the current page is a RemoteView, it does nothing for LocalViews.

Implementation

void reloadCurrentPage() async {
  final currentRoute = _history.last.routeName;
  if (!currentRoute.startsWith('/')) return;
  try {
    final tree = await beagle.viewClient.fetch(RemoteView(beagle.urlBuilder.build(currentRoute)));
    _history.last.render(tree);
  } catch(e) {
    beagle.logger.error('Could not reload the view. See the error below for more details.\n$e');
  }
}