scopeUrl property

  1. @override
set scopeUrl (String value)
override

Updates the scope the plugin's service worker is registered under by re-registering the currently registered worker script (bundled or custom) with value as its scope. Fire-and-forget — prefer registerServiceWorker to await completion, register a custom worker script, or both.

Scope caveat: a scope outside the worker script's directory requires the server to send a Service-Worker-Allowed response header (always the case for scopes broader than assets/packages/js_notifications/assets/ when using the bundled worker).

Implementation

@override
set scopeUrl(String value) {
  // Fire-and-forget by nature of a setter; awaits the initial registration
  // internally, then re-registers the current worker under the new scope.
  unawaited(serviceWorkerManager.updateScope(value));
}