flutter_sqlite_scaffold 0.1.0
flutter_sqlite_scaffold: ^0.1.0 copied to clipboard
A Dart CLI generator that scaffolds Flutter SQLite CRUD apps from SQL schema files.
Flutter SQLite Scaffold #
flutter_sqlite_scaffold is a Dart CLI generator for creating editable Flutter
SQLite CRUD projects from a simple schema.sql.
It generates a real Flutter project structure: typed models, SQLite services, controllers, routes, CRUD list/form/detail screens, validators, optional auth, optional SMTP email screens, image picker support, and starter tests.
Install #
During local development:
dart pub get
dart run bin/fss.dart --schema schema.sql
To test the global command before publishing:
dart pub global activate --source path .
fss --schema schema.sql
After publishing:
dart pub global activate flutter_sqlite_scaffold
fss --schema schema.sql
If fss is not found after activation, add Pub's global executable directory to
your user PATH. On Windows, this package includes a helper command that can
do that once:
dart pub global run flutter_sqlite_scaffold:fss_setup_path
Then open a new terminal and run:
fss --help
fss --version
fss doctor
Manual Windows PowerShell setup:
$pubCacheBin = "$env:LOCALAPPDATA\Pub\Cache\bin"
$userPath = [Environment]::GetEnvironmentVariable('Path', 'User')
if (($userPath -split ';') -notcontains $pubCacheBin) {
[Environment]::SetEnvironmentVariable('Path', "$userPath;$pubCacheBin", 'User')
}
macOS/Linux:
echo 'export PATH="$PATH:$HOME/.pub-cache/bin"' >> ~/.zshrc
source ~/.zshrc
Usage #
fss \
--schema schema.sql \
--no-email
The published package also keeps the longer flutter_sqlite_scaffold command
for compatibility.
By default, the generator writes into the current directory and reads the
package name from the current pubspec.yaml. To generate into another folder:
fss --schema schema.sql --project my_app
When running interactively, omitted feature flags are asked as quick y/n
questions. Pass the flags below to skip prompts in scripts.
Useful options:
--schema,-s: Path to the SQL schema file.--project,-p: Flutter project directory to generate into.--out,-o: Alias for--project.--in-place,--current,--here: Explicit aliases for the default current directory.--name,-n: Dart package name for the generated app.--with-email/--no-email: Include or skip SMTP email files.--with-email-screen/--no-email-screen: Include or skip the standalone send-email screen. This does not disable auth emails for registration or forgot-password when email support is enabled.--with-auth/--no-auth: Include or skip login/register/session files.--forgot-password local|email: Choose local password reset or email-based reset. Email mode requires--with-emailand sends a temporary password.
Email-enabled projects generate a blank local lib/config/email_config.dart
and a safe lib/config/email_config.example.dart. Fill the local config with
the Gmail sender and Gmail app password before using email features; the local
config is ignored by git so real SMTP credentials are not committed.
Schema Example #
CREATE TABLE students (
id INTEGER PRIMARY KEY AUTOINCREMENT,
fullName TEXT NOT NULL,
email TEXT NOT NULL UNIQUE,
gender TEXT NOT NULL CHECK(gender IN ('Male', 'Female', 'Other')),
birthday TEXT,
avatarPath TEXT
);
The generator maps schema metadata to Flutter widgets and validators. For
example, email becomes an email field, birthday becomes a date picker with a
realistic birth date validator, CHECK(field IN (...)) becomes radio/dropdown
input, and avatarPath becomes an image picker.
Status #
This is a beta scaffold generator. It is practical for local CRUD apps, learning projects, and internal tooling. For production apps, review generated auth/session/email code and move sensitive email or auth operations to a backend.
Publish #
Before publishing, update version and CHANGELOG.md, then run:
dart analyze
dart run test/generator_smoke_test.dart
dart pub publish --dry-run
If the dry run is clean, publish:
dart pub publish
After pub.dev finishes publishing, users can install the command with:
dart pub global activate flutter_sqlite_scaffold
fss --schema schema.sql