addOptionPwaStrategy method
void
addOptionPwaStrategy()
Adds a PWA strategy option for web applications.
The caching strategy to be used by the PWA service worker.
Allowed values:
none: Generate a service worker with no body. This is useful for local testing or in cases where the service worker caching functionality is not desirableoffline-first(default): Attempt to cache the application shell eagerly and then lazily cache all subsequent assets as they are loaded. When making a network request for an asset, the offline cache will be preferred.
Example:
argParser.addOptionPwaStrategy();
Implementation
void addOptionPwaStrategy() {
addOption(
'pwa-strategy',
help: '''The caching strategy to be used by the PWA service worker.
none: Generate a service worker with no body. This is useful for local testing or in cases where the service worker caching functionality is not desirable
offline-first(default): Attempt to cache the application shell eagerly and then lazily cache all subsequent assets as they are loaded. When making a network request for an asset, the offline cache will be preferred.''',
allowed: ['none', 'offline-first'],
);
}