Conversation
Radwan-Albahrani
left a comment
There was a problem hiding this comment.
Fantastic work. Very proud of you. Here are some comments for best practices but You have completed the task! Well done!
| import 'taskList.dart'; | ||
|
|
||
| //you can make it global so you can access it from anywhere | ||
| List<Task> _tasks = []; |
There was a problem hiding this comment.
this variable is not necessary anymore
| List<Task> _tasks = []; |
| Task operator [](int taskID) { | ||
| return _tasks[taskID]; | ||
| } |
There was a problem hiding this comment.
smart way to add an operator to the taskList. Didnt even know that was possible 😂
| if (taskID <= tasks.length && taskID > 0) { | ||
| stdout.write("Enter Your New Title:"); | ||
| String? Title = stdin.readLineSync(); | ||
| tasks[taskID].title = Title!; |
There was a problem hiding this comment.
while this method is smart, it allows for direct access to the task attributes without any security measures. Its why i recommended adding, updating, and removing directly from inside the TaskList class. This would ensure all the data preprocessing you will do including null checking and stuff happens before the title is changed
| class TaskListApp { | ||
| // TODO: Implement Task list app | ||
| //For Description Update | ||
| void updateDescription(_tasks) { |
There was a problem hiding this comment.
unnecessary variable
| void updateDescription(_tasks) { | |
| void updateDescription() { |
| } | ||
|
|
||
| //For Title Update | ||
| void updateTitle(_tasks) { |
There was a problem hiding this comment.
unnecessary variable
| void updateTitle(_tasks) { | |
| void updateTitle() { |
| } | ||
| switch (choice) { | ||
| case 1: | ||
| updateTitle(_tasks); |
There was a problem hiding this comment.
unnecessary variable
| updateTitle(_tasks); | |
| updateTitle(); |
or if you move it to the TaskList Class
| updateTitle(_tasks); | |
| tasks.updateTitle(); |
| updateTitle(_tasks); | ||
| break; | ||
| case 2: | ||
| updateDescription(_tasks); |
There was a problem hiding this comment.
unnecessary variable
| updateDescription(_tasks); | |
| updateDescription(); |
| void choose() { | ||
| int choice = 0; | ||
| try { | ||
| stdout.write("To Change Title:1 / To Change Description:2 \n Your Choice?"); |
There was a problem hiding this comment.
Could make this prettier
| stdout.write("To Change Title:1 / To Change Description:2 \n Your Choice?"); | |
| stdout.write("1. Change Title\n2. Change Description\n Your Choice: "); |
| bool validChoice = false; | ||
| while (!validChoice) { | ||
| try { | ||
| stdout.write("Your Choice?"); |
There was a problem hiding this comment.
could make this prettier
| stdout.write("Your Choice?"); | |
| stdout.write("Your Choice: "); |
No description provided.