@@ -17,7 +17,7 @@ class DatabaseTransactionBase<TABLES extends TablesBase> {
1717 final TABLES tables;
1818 static final columnNamePattern = RegExp (r'^[a-z_]+$' );
1919
20- void _assertColumnNames (Map <String , Object > values) {
20+ void _assertColumnNames (Map <String , Object ? > values) {
2121 assert ((() {
2222 for (final key in values.keys) {
2323 if (! columnNamePattern.hasMatch (key)) {
@@ -49,8 +49,8 @@ class DatabaseTransactionBase<TABLES extends TablesBase> {
4949
5050 Future <int > executeUpdate (
5151 String table, {
52- @ required Map <String , Object > set ,
53- @ required Map <String , Object > where,
52+ required Map <String , Object ? > set ,
53+ required Map <String , Object > where,
5454 bool setContainsOptional = false ,
5555 }) async {
5656 assert (set != null );
@@ -78,14 +78,14 @@ class DatabaseTransactionBase<TABLES extends TablesBase> {
7878
7979 /// Removes entries in [values] which have a `null` value, and replaces
8080 /// all [Optional] values with their actual value.
81- Map <String , Object > flattenOptionals (Map <String , Object > values) {
82- Object unwrap (Object value) => value is Optional ? value.orNull : value;
81+ Map <String , Object ? > flattenOptionals (Map <String , Object ? > values) {
82+ Object ? unwrap (Object ? value) => value is Optional ? value.orNull : value;
8383 return Map .fromEntries (values.entries
8484 .where ((element) => element.value != null )
8585 .map ((e) => MapEntry (e.key, unwrap (e.value))));
8686 }
8787
88- bool _assertCorrectValues (Map <String , Object > values) {
88+ bool _assertCorrectValues (Map <String , Object ?> ? values) {
8989 if (values == null ) {
9090 return true ;
9191 }
@@ -103,9 +103,9 @@ class DatabaseTransactionBase<TABLES extends TablesBase> {
103103
104104 Future <int > execute (
105105 String fmtString, {
106- Map <String , Object > values,
107- int timeoutInSeconds,
108- int expectedResultCount,
106+ Map <String , Object ?> ? values,
107+ int ? timeoutInSeconds,
108+ int ? expectedResultCount,
109109 }) async {
110110 try {
111111 assert (_assertCorrectValues (values));
@@ -126,9 +126,9 @@ class DatabaseTransactionBase<TABLES extends TablesBase> {
126126 }
127127
128128 Future <PostgreSQLResult > query (String fmtString,
129- {Map <String , Object > values,
130- bool allowReuse,
131- int timeoutInSeconds}) async {
129+ {Map <String , Object >? values,
130+ bool ? allowReuse,
131+ int ? timeoutInSeconds}) async {
132132 assert (_assertCorrectValues (values));
133133 return _conn.query (fmtString,
134134 substitutionValues: values,
@@ -146,9 +146,9 @@ class CustomBind {
146146abstract class DatabaseAccessBase <TX extends DatabaseTransactionBase <TABLES >,
147147 TABLES extends TablesBase > {
148148 DatabaseAccessBase ({
149- @ required this .config,
150- @ required this .tables,
151- @ required this .migrations,
149+ required this .config,
150+ required this .tables,
151+ required this .migrations,
152152 }) : assert (config != null ),
153153 assert (tables != null ),
154154 assert (migrations != null );
@@ -157,11 +157,11 @@ abstract class DatabaseAccessBase<TX extends DatabaseTransactionBase<TABLES>,
157157 final DatabaseConfig config;
158158 final MigrationsProvider <TX , TABLES > migrations;
159159
160- PostgreSQLConnection _conn;
160+ PostgreSQLConnection ? _conn;
161161
162162 Future <PostgreSQLConnection > _connection () async {
163163 if (_conn != null ) {
164- return _conn;
164+ return _conn! ;
165165 }
166166 final conn = PostgreSQLConnection (
167167 config.host,
@@ -185,7 +185,7 @@ abstract class DatabaseAccessBase<TX extends DatabaseTransactionBase<TABLES>,
185185 }
186186
187187 Future <void > dispose () async {
188- await _conn.close ();
188+ await _conn! .close ();
189189 _conn = null ;
190190 }
191191
@@ -229,7 +229,7 @@ abstract class DatabaseAccessBase<TX extends DatabaseTransactionBase<TABLES>,
229229
230230 final migrationRun = clock.now ().toUtc ();
231231 await run ((conn) async {
232- final migrations = this .migrations.migrations;
232+ final List < Migrations < TX , TABLES >> migrations = this .migrations.migrations;
233233 for (final migration in migrations) {
234234 if (migration.id > lastMigration) {
235235 _logger.fine ('Running migration ${migration .id } '
@@ -315,9 +315,9 @@ abstract class MigrationsProvider<TX extends DatabaseTransactionBase<TABLES>,
315315class Migrations <TX extends DatabaseTransactionBase <TABLES >,
316316 TABLES extends TablesBase > {
317317 Migrations ({
318- @ required this .id,
318+ required this .id,
319319 this .versionCode = 'a' ,
320- @ required this .up,
320+ required this .up,
321321 }) : assert (id != null ),
322322 assert (up != null );
323323
0 commit comments