saveStudy method

Future<bool> saveStudy(
  1. SmartphoneStudy study
)

Save the study persistently to a local cache. Returns true if successful.

Implementation

Future<bool> saveStudy(SmartphoneStudy study) async {
  bool success = true;
  try {
    await _database?.insert(
      STUDY_TABLE_NAME,
      _getMap(study),
      conflictAlgorithm: ConflictAlgorithm.replace,
    );
    debug('$runtimeType - Inserted study - $study');
  } catch (exception) {
    success = false;
    warning('$runtimeType - Failed to save study - $exception');
  }
  return success;
}