convertToJsUrlStrategy function Null safety

JsUrlStrategy convertToJsUrlStrategy(
  1. UrlStrategy strategy
)

Given a Dart implementation of URL strategy, converts it to a JavaScript URL strategy to be passed through JS interop.

Implementation

JsUrlStrategy convertToJsUrlStrategy(UrlStrategy strategy) {
  return JsUrlStrategy(
    getPath: allowInterop(strategy.getPath),
    getState: allowInterop(strategy.getState),
    addPopStateListener: allowInterop(strategy.addPopStateListener),
    prepareExternalUrl: allowInterop(strategy.prepareExternalUrl),
    pushState: allowInterop(strategy.pushState),
    replaceState: allowInterop(strategy.replaceState),
    go: allowInterop(strategy.go),
  );
}