'Dart Flutter The method 'getDatabasePath' isn't defined for the type 'sqliteDaatabase'. Error
I have a code like this:
import "package:sqflite/sqflite.dart";
import "package:path/path.dart";
import "package:path_provider/path_provider.dart";
class sqliteDaatabase {
final _dbName = "testsData.db";
final _tableName = "tests";
initDb() async {
String path = await getDatabasePath();
String createTable = "CREATE TABLE ${_tableName} (name TEXT)";
openDatabase(join(path, _dbName),
onCreate: (db, version) {
db.execute("");
},
version: 1,
);
}
}
But it throws an error in the code.
Error:
I think I need to pull a package from the imports section. Can you help me?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

