I'm currently using the path_provider
package for the initialisation of Hive
in my main.dart
:
final appDocumentDirectory = await pathProvider.getApplicationDocumentsDirectory();
Hive.init(appDocumentDirectory.path);
I want to embed a local database file from my assets folder and followed a Youtube Tutorial (Link) in which he was using the path
package for 'joining' the databasePath with the database file. Here's the code:
_db = await openDatabase('assets/trails.db');
var databasePath = await getDatabasesPath();
var path = join(databasePath,'trails.db');
The docs are saying:
path
: The path package provides common operations for manipulating paths: joining, splitting, normalizing, etc.path_provider
: A Flutter plugin for finding commonly used locations on the filesystem.
But my question now is, what exactly is the difference between these two packages? Would it be possible for me to delete one of them of my pubspec.yaml
file and use one package for both use-cases (to avoid boilerplate code)?