Methods
closeDB ({String ? dbName })
→ Future <void >
Close the Database and clean up its streams.
delete (Map <String , dynamic > map , String table , {required List <String > keys , String ? dbName })
→ Future <int >
Delete rows matching keys from map.
Returns the number of deleted rows.
execute (String sql , {List <String > ? tables , List <Object ? > params = const [] , String ? dbName })
→ Future
Executes an SQL statement.
executeBatch (List <String > sqls , {List <List <Object ? > > ? paramsList , List <String > ? dbName , List <List <String > > ? tablesList })
→ Future <List >
Execute a batch of SQL statements in a single round-trip (gRPC) or
sequentially (native). Each statement is processed through execute
so INSERT/UPDATE/DELETE return their scalar result.
fixBoolParams (List <Object ? > params )
→ List <Object ? >
Convert booleans to integers (true=1, false=0) in a new list.
Does not mutate the original params list.
getDatabase ({String ? dbName })
→ DatabaseCore ?
Returns the internal DatabaseCore instance for the given db name.
Handle with care: exposes the underlying database adapter.
getDatabases ()
→ Databases
Expose the databases object.
getVersion ({String ? dbName })
→ Future <int >
insert (Map <String , dynamic > map , String table , {String ? dbName })
→ Future <int >
Insert a new record from map into table.
Returns the new row id.
isWeb ()
→ bool
noSuchMethod (Invocation invocation )
→ dynamic
Invoked when a nonexistent method or property is accessed.
inherited
openDB (String path , {int version = 0 , OnCreate ? onCreate , OnUpgrade ? onUpgrade , String ? dbName , bool useGRPC = false })
→ Future <DatabaseInfo >
Open the Database and returns DatabaseInfo with creation status and version.
query (String sql , {List <Object ? > params = const [] , FromMap ? fromMap , bool singleResult = false , String ? dbName })
→ Future
Executes a query and returns the results.
save (Map <String , dynamic > map , String table , {List <String > ? keys , String ? dbName })
→ Future <int >
Insert or update depending on whether a row with the same key exists (UPSERT).
Returns the row id.
setVersion (int version , {String ? dbName })
→ Future <void >
toString ()
→ String
A string representation of this object.
inherited
transaction <T > (Future <T > action (), {String ? dbName })
→ Future <T >
Execute action inside a database transaction.
update (Map <String , dynamic > map , String table , {required List <String > keys , String ? dbName })
→ Future <int >
Update a row identified by keys with values from map.
Returns the number of affected rows.
updateStreams (List <String > ? tables )
→ Future <void >
Refresh streams that watch any of the tables.
If tables is null, all streams are refreshed.
watch (String sql , {List <Object ? > params = const [] , FromMap ? fromMap , bool singleResult = false , required List <String > tables , String ? dbName })
→ Stream
Returns a Stream that emits results of sql whenever tables change.