Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasdidur committed Apr 3, 2024
1 parent 342fca1 commit b18caee
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions floor/lib/src/sqflite_database_factory.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,16 @@ final DatabaseFactory sqfliteDatabaseFactory = () {
}();

extension DatabaseFactoryExtension on DatabaseFactory {
Future<String> getDatabasePath(final String name, {String? path}) async {
if(path == null){
path = await this.getDatabasesPath();
}

var dir= Directory(path);
Future<String> getDatabasePath(final String name) async {
late String databasesPath;

if (!dir.existsSync()) {
dir.create(recursive: true);
final file = File(name);
if (file.isAbsolute) {
databasesPath = file.path;
} else {
databasesPath = join(await this.getDatabasesPath(), name);
}

return join(dir.path, name);
return databasesPath;
}
}

0 comments on commit b18caee

Please sign in to comment.