Web Cache Killer

A Flutter package that solves Flutter web cache problems by automatically renaming JavaScript files with timestamps during build process.

The Problem

Flutter web apps often face caching issues where users see old versions of your app even after deployment. Browsers cache JavaScript files aggressively, causing users to see outdated content until they manually clear their cache.

The Solution

Web Cache Killer automatically renames your Flutter web JavaScript files with unique timestamps and updates all references, ensuring users always get the latest version of your app without manual cache clearing.

Features

  • ๐Ÿ”ง Cross-platform - Works on Windows, macOS, and Linux
  • ๐Ÿ“ฆ Zero dependencies - Uses built-in Dart archive package
  • ๐Ÿ•’ Cache busting - Automatic timestamp-based cache busting
  • ๐Ÿš€ Simple commands - Easy to use CLI tool
  • ๐Ÿ“ค Optional upload - Upload to tmpfiles.org and get direct download link http://tmpfiles.org/dl/123456/web.zip

Installation

dart pub global activate web_cache_killer

Usage

Basic Commands

# Build and create zip
web_cache_killer

# Custom name (creates build/app/ and app.zip)
web_cache_killer --name app

# Auto upload
web_cache_killer --auto-upload

# Build only (no zip)
web_cache_killer --no-zip

Options

# Verbose output
web_cache_killer --verbose

# Skip clean step (faster)
web_cache_killer --no-clean

# Combined options
web_cache_killer --name myapp --auto-upload --verbose

How It Works

Automatically renames JavaScript files with timestamps for cache busting:

Before:

flutter.js โ†’ flutter_20241201_143022_456.js
main.dart.js โ†’ main_20241201_143022_456.dart.js

All references in HTML files are automatically updated.

File Structure

Default:

build/
โ”œโ”€โ”€ web/           # Built files
โ””โ”€โ”€ web.zip        # Package

Custom name:

build/
โ”œโ”€โ”€ app/           # Built files  
โ””โ”€โ”€ app.zip        # Package

Expected Output

๐Ÿš€ Web Cache Killer
==================================
Checking requirements...
โœ… Requirements satisfied
๐Ÿงน Cleaning...
โœ… Cleaned
๐Ÿ”ง Building web...
โœ… Build completed
๐Ÿ•’ Applying cache busting...
โœ… Cache busting applied (3 files)
๐Ÿ“ฆ Creating deployment package...
โœ… Successfully created web.zip (Size: 7.9 MB)

==================================
โœ… ๐ŸŽ‰ Build Completed!

โœ… Created: web.zip
๐Ÿ“ Local: /path/to/project/build/web.zip

Troubleshooting

  • "pubspec.yaml not found" - Run from Flutter project root
  • "Flutter not found" - Install Flutter SDK and add to PATH
  • Upload fails - Check internet connection, zip still available locally

Libraries

services/build_service
services/cache_buster
services/upload_service
utils/file_utils
utils/logger
web_cache_killer
Web Cache Killer - A CLI tool for building and deploying Flutter web apps with timestamp-based cache busting.