flutter-wasm-web
/flutter-wasm-web
Pomaga budować, optymalizować i wdrażać aplikacje Flutter Web dla WebAssembly (Wasm-GC) z nowoczesnym JS interop.
- Autor
- dhruvanbhalara ↗
- Repozytorium
- skills ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 30.08.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 1
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 30.08.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Pomaga budować, optymalizować i wdrażać aplikacje Flutter Web dla WebAssembly (Wasm-GC) z nowoczesnym JS interop.
Oryginalny opis (EN)
Use when building, optimizing, and deploying Flutter Web applications targeting WebAssembly (Wasm-GC) with modern JS interop.
Jak działa
- Contents
- Compilation & Deployment
- Modern JS Interop (dart:jsinterop and package:web)
- Wasm-Specific Limitations & Solutions
- Debugging WebAssembly
Podgląd SKILL.md
---
name: flutter-wasm-web
description: Use when building, optimizing, and deploying Flutter Web applications targeting WebAssembly (Wasm-GC) with modern JS interop.
metadata:
platforms: "flutter, web"
languages: "dart, javascript"
category: "web"
---
# Flutter Web with WebAssembly (Wasm-GC)
Flutter Web supports compilation to **WebAssembly (Wasm-GC)** for near-native UI rendering performance, smoother animations, and faster load times.
## Contents
- [Compilation & Deployment](#compilation--deployment)
- [Modern JS Interop (`dart:js_interop` and `package:web`)](#modern-js-interop-dartjs_interop-and-packageweb)
- [Wasm-Specific Limitations & Solutions](#wasm-specific-limitations--solutions)
- [Debugging WebAssembly](#debugging-webassembly)
---
## Compilation & Deployment
Compile your application to WebAssembly using the Flutter CLI:
```bash
flutter build web --wasm
```
### Server Configuration
Wasm-GC requires serving specific files with correct HTTP headers. Ensure your web host (Firebase Hosting, Cloudflare, Vercel, Nginx) includes:
- **`Content-Type: application/wasm`** for the generated `.wasm` files.
- COOP and COEP headers (recommended for performance and multithreading safety):
- `Cross-Origin-Opener-Policy: same-origin`
- `Cross-Origin-Embedder-Policy: require-corp`
---
## Modern JS Interop (`dart:js_interop` and `package:web`)
Wasm-GC compilation **strictly prohibits** using the legacy `dart:html`, `dart:js`, or `package:js` libraries. You must utilize the standard `dart:js_interop` and `package:web` packages.
### JS Interop Core Principles
- **Do not import `dart:html`**. Import `package:web/web.dart` for DOM access.
- Use the `@JS()` annotation for declaring external JavaScript functions.
- Always use Dart JS Types (e.g., `JSString`, `JSNumber`, `JSBool`, `JSAny`, `JSObject`).
### Example: Invoking a JS API
```dart
import 'dart:js_interop';
import 'package:web/web.dart';
// Declare external JS API
@JS('console.log')
external void jsConsoleLog(JSAny message);
@JS('localStorage.setItem')
external void jsSetLocalStorage(JSString key, JSString value);
void main() {
// Convert Dart types to JS types
jsConsoleLog('Hello from Wasm-GC!'.toJS);
jsSetLocalStorage('app_mode'.toJS, 'dark'.toJS);
// Accessing the DOM via package:web
final windowEl = window;
jsConsoleLog(windowEl.location.href.toJS);
}
```
---
## Wasm-Specific Limitations & Solutions
### 1. No `dart:io`
- **Impact**: Filesystem, Socket, and standard HTTP Client won't compile.
- **Solution**: Use `package:http` (resolves to browser-native Fetch API) and use IndexedDB or local storage for caching.
### 2. Isolate/Threading limitations
- **Impact**: Standard Dart VM isolates do not run in WebAssembly. Calling `Isolate.spawn` or `compute()` will throw runtime errors on web.
- **Solution**: Use web worker threads via JS Interop if heavy processing is required, or perform computations on the main thread in small chunks.
### 3. Font and Asset Loading
- **Impact**: Wasm compilation renders widgets using CanvasKit. Custom fonts must be declared explicitly in `pubspec.yaml` to prevent fallback font rendering.
---
## Debugging WebAssembly
- **Chrome Developer Tools**: Chrome supports debugging Wasm-GC source maps. You can inspect Dart source code directly in the Chrome Sources panel.
- **Check Compatibility**: Use `flutter run -d chrome --wasm` to run and debug locally under Wasm.
Wersje
W bazie nie ma innych skilli o nazwie flutter-wasm-web.
Migawka bazy z 13.11.2026 · wersja paczki 8282b6889c65 (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 95wasm
Pomaga w integracji WebAssembly i WASI, modelu komponentów oraz kompilacji kodu Rust i Go do WASM. - 100wasm-rust-expert
Pomaga projektować granicę Rust i WebAssembly, integrację wasm-bindgen i web-sys, celowanie w WASI oraz wydajność Wasm. - 100webassembly-wasm-runtimes
Kompiluje natywny kod do WebAssembly i uruchamia moduły Wasm w przeglądarce oraz na serwerze, np. w Wasmtime. - 100wasm-js
Pomaga tworzyć wydajną grafikę WebAssembly z JavaScript w animacjach w czasie rzeczywistym i obliczeniach geometrycznych. - 90agent-wasm-specialist
Działa jako subagent specjalista od WebAssembly: WASI, wasm-bindgen, Emscripten i kompilacja między językami, w tym optymalizacja wydajności WASM. - 100webassembly-expert
Tworzy produkcyjne moduły WebAssembly dla przeglądarki i serwera z dobrą wydajnością i integracją z JavaScript: WASI, kompilacja Rust, C i C++, Emscripten i wasmtime.