databasePath property

Future<String> databasePath

Full path and name of the DB according to this format:

~/carp-data-yyyy-mm-dd-hh-mm-ss-ms.db

where the date is in UTC format / zulu time.

Implementation

Future<String> get databasePath async {
  if (_databasePath == null) {
    // get the location of the SQLite DB
    String path = await getDatabasesPath();
    final created = DateTime.now()
        .toUtc()
        .toString()
        .replaceAll(RegExp(r':'), '-')
        .replaceAll(RegExp(r' '), '-')
        .replaceAll(RegExp(r'\.'), '-');

    _databasePath = '$path/carp-data-$created.db';
  }

  return _databasePath!;
}