SupgenBuilder class
A code generator builder that creates Dart classes from PostgreSQL/Supabase database schemas.
This builder integrates with the Dart build system to automatically generate:
- Database table models as Dart classes
- Database enums as Dart enums
- Database views as Dart classes
The builder reads database configuration from .env files and pubspec.yaml
configuration to connect to PostgreSQL/Supabase databases and generate
corresponding Dart code.
Usage
Configure your pubspec.yaml:
sup_gen_option:
output: lib/supabase_models
enable: true
schema: 'public'
useSsl: false
And your .env file:
SUPABASE_DB_USER=postgres
SUPABASE_DB_HOST=localhost
SUPABASE_DB_PORT=5432
SUPABASE_DB_PASSWORD=password
SUPABASE_DB=database_name
SUPABASE_DB_SCHEMA=public
Constructors
- SupgenBuilder({required BuilderOptions options})
- Creates a new SupgenBuilder instance.
Properties
-
buildExtensions
→ Map<
String, List< String> > -
Defines the mapping of input files to output files for the build system.
no setter
- generator → SupgenGenerator
-
The core generator that handles database introspection and code generation.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- options → BuilderOptions
-
Build options passed from the build system.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
build(
BuildStep buildStep) → Future< void> - Executes the code generation process.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited