sqflite-common-ffi-web-options

Configure custom sqflite web factories, worker options, and IndexedDB stores for Flutter web.

3.0k|555|Updated May 22, 2017
One-click install
npx skills add https://github.com/tekartik/sqflite --skill sqflite-common-ffi-web-options-tekartik
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: sqflite-common-ffi-web-options
Source: https://github.com/tekartik/sqflite/tree/main/packages_web/sqflite_common_ffi_web/skills/sqflite-common-ffi-web-options
Command: npx skills add https://github.com/tekartik/sqflite --skill sqflite-common-ffi-web-options-tekartik

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? The default sqflite web factory loads sqflite_sw.js and sqlite3.wasm relative to the page and stores everything in one IndexedDB database, which breaks when apps are served from nested routes, need versioned worker files, or require isolated database stores. This Skill guides customization and debugging of sqflite_common_ffi_web beyond those defaults. ## Core Features & Use Cases - Custom Factories: Build factories with createDatabaseFactoryFfiWeb using SqfliteFfiWebOptions for custom sqlite3WasmUri, sharedWorkerUri, and indexedDbName values. - Isolated Stores: Run separate IndexedDB stores (for example production data versus a scratch store) by pairing distinct worker script URLs with distinct store names. - Debugging: Enable sqliteFfiWebDebugWebWorker message logging and inspect the shared worker in Chrome via chrome://inspect/#workers. - Use Case: An app deployed under /app/ with a versioned worker file uses createDatabaseFactoryFfiWeb with sharedWorkerUri '/app/sqflite_sw_v2.js' and sqlite3WasmUri '/app/sqlite3.wasm' so the worker and wasm load correctly after every package upgrade. ## Quick Start Ask the AI to create a custom sqflite web database factory that loads sqflite_sw.js and sqlite3.wasm from a specific path and uses a custom IndexedDB store name.

Frequently Asked Questions about sqflite-common-ffi-web-options

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I use a custom sqlite3.wasm location with sqflite on Flutter web?▼

Pass a custom sqlite3WasmUri in SqfliteFfiWebOptions to createDatabaseFactoryFfiWeb. Use an absolute path like /sqlite3.wasm when the app is served from nested routes, since the default resolves relative to the page or worker script.

How do I create separate IndexedDB stores for sqflite web databases?▼

Set a distinct indexedDbName in SqfliteFfiWebOptions and pair it with a distinct sharedWorkerUri, such as a copy of the worker script. A shared worker is keyed by its script URL, so two factories sharing one worker URL always share the same store.

Does sqflite_common_ffi_web work without a web worker?▼

Yes, pass noWebWorker: true to createDatabaseFactoryFfiWeb to load the wasm on the main thread using the same options. The sharedWorkerUri option is ignored in this mode, and databaseFactoryFfiWebNoWebWorker provides this with default options.

Why does sqflite web fail with 'An error occurred while initializing the web worker'?▼

This error means the worker script could not be loaded, usually due to a wrong sharedWorkerUri, setup not being run, or the file not being deployed. The error message names the URL that was tried, so verify the file exists at that path.

Can I use inMemory option for a private sqflite web database?▼

No, the inMemory option is declared and transported but the current loader always opens the IndexedDB file system. Use inMemoryDatabasePath as the database path instead for a non-persistent database.

How do I debug the sqflite web shared worker in Chrome?▼

Set sqliteFfiWebDebugWebWorker to true before the first call to log every worker message, then open chrome://inspect/#workers in Chrome to inspect the shared worker console, breakpoints, and network activity.