Fix crash in devtools schema validator (#2888)

This commit is contained in:
Simon Binder 2024-02-12 22:00:20 +01:00
parent fe578223af
commit e1f7aa3be3
No known key found for this signature in database
GPG Key ID: 7891917E4147B8C0
1 changed files with 6 additions and 6 deletions

View File

@ -60,9 +60,9 @@ class SchemaVerifier extends AutoDisposeAsyncNotifier<SchemaStatus> {
for (final row in await database
.select('SELECT name, sql FROM sqlite_schema;', [])) {
final name = row['name'] as String;
final sql = row['sql'] as String;
final sql = row['sql'] as String?;
if (!isInternalElement(name, virtualTables)) {
if (!isInternalElement(name, virtualTables) && sql != null) {
actual.add(Input(name, sql));
}
}
@ -95,9 +95,9 @@ class SchemaVerifier extends AutoDisposeAsyncNotifier<SchemaStatus> {
for (final row
in newDatabase.select('SELECT name, sql FROM sqlite_schema;', [])) {
final name = row['name'] as String;
final sql = row['sql'] as String;
final sql = row['sql'] as String?;
if (!isInternalElement(name, virtuals)) {
if (!isInternalElement(name, virtuals) && sql != null) {
inputs.add(Input(name, sql));
}
}
@ -136,8 +136,8 @@ class DatabaseSchemaCheck extends ConsumerWidget {
TextSpan(text: message),
],
)),
AsyncError(:var error) =>
Text('The schema could not be validated due to an error: $error'),
AsyncError(:var error, :var stackTrace) => Text(
'The schema could not be validated due to an error: $error, ${stackTrace}'),
_ => Text.rich(TextSpan(
text: 'By validating your schema, you can ensure that the current '
'state of the database in your app (after migrations ran) '