-
-
Save parzibyte/4a58753196798321a255ad2fb2e003ee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Database db; | |
if (Platform.isWindows || Platform.isLinux) { | |
// Initialize FFI | |
sqfliteFfiInit(); | |
var databaseFactory = databaseFactoryFfi; | |
db = await databaseFactory.openDatabase(join(".", "ejemplo.db")); | |
} else { | |
db = await openDatabase( | |
// Set the path to the database. Note: Using the `join` function from the | |
// `path` package is best practice to ensure the path is correctly | |
// constructed for each platform. | |
join(await getDatabasesPath(), 'ejemplo.db'), | |
// When the database is first created, create a table to store dogs. | |
onCreate: (db, version) { | |
// Run the CREATE TABLE statement on the database. | |
}, | |
// Set the version. This executes the onCreate function and provides a | |
// path to perform database upgrades and downgrades. | |
version: 1, | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment