sqflite-darwin-setup

Configure and troubleshoot the iOS and macOS implementation of the sqflite Flutter plugin.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Setting up SQLite on iOS and macOS with Flutter involves platform-specific pitfalls: CocoaPods versus Swift Package Manager builds, deployment targets, FMDB leftovers, file protection on locked devices, and differing SQLite result codes. This Skill guides you through configuring and debugging the sqflite_darwin implementation so database code works correctly on Apple platforms. ## Core Features & Use Cases - Plugin setup and registration: Explains when to add sqflite_darwin explicitly, how SqfliteDarwin.registerWith installs the databaseFactory, and supported requirements (iOS 12+, macOS 10.14+, CocoaPods and SPM). - Storage and file handling: Covers getDatabasesPath versus path_provider, read-only opens, deleteDatabase side files (-wal, -shm, -journal), and creating unprotected folders for locked-device background access. - Build troubleshooting: Resolves FMDB pod conflicts, deployment target failures, Podfile post_install fixes, and App Store ITMS-91065 signature errors. - Use Case: Your Flutter app crashes with DatabaseException(open_failed) when a push notification wakes a background isolate on a locked iPhone. Use this Skill to move the database into a folder created with SqfliteDarwin.createUnprotectedFolder. ## Quick Start Ask the assistant to configure sqflite for iOS and macOS in your Flutter project and fix any CocoaPods or deployment target build errors.

Frequently Asked Questions about sqflite-darwin-setup

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

FAQPage Schema
How do I set up sqflite on iOS and macOS in Flutter?▼

Add the sqflite package to pubspec.yaml and it automatically pulls in sqflite_darwin as the default iOS/macOS implementation. Registration happens via SqfliteDarwin.registerWith, so you can use openDatabase from package:sqflite directly with no extra setup.

When should I add sqflite_darwin explicitly to pubspec?▼

Add sqflite_darwin explicitly only when your app does not depend on sqflite, for example when coding against package:sqflite_common and shipping iOS/macOS only. Registration is automatic, then use databaseFactory from sqflite_common.

Why do I get Module 'FMDB' not found after upgrading sqflite?▼

sqflite 2.3.2+ bundles its own renamed FMDB copy, so no FMDB pod is needed. Remove any pod 'FMDB' line from your Podfile, run flutter clean, and delete ios/Podfile.lock and macos/Podfile.lock.

Does sqflite support Swift Package Manager on iOS and macOS?▼

Yes, sqflite_darwin supports both CocoaPods (sqflite_darwin.podspec) and Swift Package Manager via Package.swift. It requires iOS 12.0+, macOS 10.14+, Flutter 3.44+, and Dart 3.12+, and bundles a privacy manifest.

Why does openDatabase fail on a locked iPhone in a background isolate?▼

Files in protected folders are unreadable while the device is locked, causing DatabaseException(open_failed). Create the database inside a folder made with SqfliteDarwin.createUnprotectedFolder, which sets NSFileProtectionNone, for non-sensitive data only.

Where should I store SQLite databases on iOS with sqflite?▼

getDatabasesPath returns the app Documents directory, which is visible in Files and iCloud backups. Prefer path_provider's getLibraryDirectory or application support directory for databases users should not see or back up.