JsonStore constructor Null safety

JsonStore(
  1. {Database? database,
  2. Directory? dbLocation,
  3. String dbName = 'json_store',
  4. bool inMemory = false}
)

create instance of your singleton JsonStore database If you need to supply your own database for whatever reason (maybe mocking or something) dbLocation If you want to use a different location for the DB file (default: ApplicationDocumentsDirectory) dbName Provide a custom database file name (default: json_store) inMemory If you don't want to store to disk but rather have it all in memory (default: false)

Implementation

factory JsonStore({
  Database? database,
  Directory? dbLocation,
  String dbName = 'json_store',
  bool inMemory = false,
}) =>
    _instance ??=
        JsonStore._createInstance(database, dbLocation, dbName, inMemory);