0

How to run with the null safety using the following packages

  • package:sqflite
  • package:sqflite_common
  • package:synchronized

Code:

void database() async {
// ignore: unused_local_variable
var database = await openDatabase('alimaher.db', version: 1,
    onCreate: (database, vervion) {
  // ignore: avoid_print
  print('database created');
  database
      .execute(
          'CREATE TABLE tasks (id INTEGER PRIMARY KEY,title TEXT, date TEXT,time TEXT,status TEXT ) ')
      .then((value) {
    // ignore: avoid_print
    print('table created');
  }).catchError((error) {
    // ignore: avoid_print
    print('error when creating table ${error.toString()}');
  });
}, onOpen: (database) {
  // ignore: avoid_print
  print('database opened');
});

}

The error message:

Error: Cannot run with sound null safety, because the following dependencies don't support null safety:

  • package:sqflite
  • package:sqflite_common
  • package:synchronized
nvoigt
  • 75,013
  • 26
  • 93
  • 142
alimaher
  • 1
  • 3

2 Answers2

0

All three packages do support sound null-safety in their latest releases.

You did not show your pubspec.yaml, but I guess you will need to update those packages to their most recent versions.

nvoigt
  • 75,013
  • 26
  • 93
  • 142
0

Either update packages to last versions or build with --no-sound-null-safety argument

Autocrab
  • 3,474
  • 1
  • 15
  • 15