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

2 Answers 2

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.

2
  • my packages is in the last version :
    – alimaher
    Jun 21, 2021 at 7:05
  • I agree, all these package support null safety, maybe you are getting other log error? Jun 21, 2021 at 7:08
0

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

1
  • I already updated the packages but not run
    – alimaher
    Jun 21, 2021 at 7:02

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.