freshWithTasks method

Future<TaskListCreateResult> freshWithTasks(
  1. List<String> tasks, {
  2. String? listTitle,
  3. String? spaceDisplayName,
  4. String? userDisplayName,
})

Implementation

Future<TaskListCreateResult> freshWithTasks(
  List<String> tasks, {
  String? listTitle,
  String? spaceDisplayName,
  String? userDisplayName,
}) async {
  final spaceId = await freshAccountWithSpace(
    spaceDisplayName: spaceDisplayName ?? 'Tasks',
    userDisplayName: userDisplayName,
  );
  await ensureTasksAreEnabled(spaceId);
  await gotoSpace(spaceId, appTab: Key(TabEntry.tasks.name));
  await navigateTo([
    TasksListPage.createNewTaskListKey,
  ]);

  final taskListId = await createTaskList(
    listTitle ?? 'Errands',
    tasks: tasks,
  );
  return (spaceId: spaceId, taskListId: taskListId);
}