prepareExternalUrl method Null safety

  1. @override
String prepareExternalUrl(
  1. String internalUrl
)
override

Given a path that's internal to the app, create the external url that will be used in the browser.

Implementation

@override
String prepareExternalUrl(String internalUrl) {
  // It's convention that if the hash path is empty, we omit the `#`; however,
  // if the empty URL is pushed it won't replace any existing fragment. So
  // when the hash path is empty, we instead return the location's path and
  // query.
  return internalUrl.isEmpty
      ? '${_platformLocation.pathname}${_platformLocation.search}'
      : '#$internalUrl';
}