saveQueue method

Future<bool> saveQueue()

Save the queue persistently to a file. Returns true if successful.

Implementation

Future<bool> saveQueue() async {
  bool success = true;
  try {
    String name = (await filename)!;
    debug("$runtimeType - Saving task queue to file '$name'.");
    final json = jsonEncode(UserTaskSnapshotList.fromUserTasks(userTasks));
    File(name).writeAsStringSync(json);
  } catch (exception) {
    success = false;
    warning('$runtimeType - Failed to save task queue - $exception');
  }
  return success;
}