updateTaskListTitle function

Future<void> updateTaskListTitle(
  1. dynamic context,
  2. dynamic taskList,
  3. String newName
)

Implementation

Future<void> updateTaskListTitle(
    BuildContext context,
    TaskList taskList,
    String newName,
    ) async {
  EasyLoading.show(status: L10n.of(context).updatingTask);
  final updater = taskList.updateBuilder();
  updater.name(newName);
  try {
    await updater.send();
    EasyLoading.dismiss();
    if (!context.mounted) return;
    Navigator.pop(context);
  } catch (e, s) {
    _log.severe('Failed to rename tasklist', e, s);
    if (!context.mounted) {
      EasyLoading.dismiss();
      return;
    }
    EasyLoading.showError(
      L10n.of(context).updatingTaskFailed(e),
      duration: const Duration(seconds: 3),
    );
  }
}