Todo Model

Learn how to build a Todo model class.

We'll cover the following

The Todo class has several fields that represent the properties of a todo item:

  • id: This is a string that is used to store the document ID of the todo item from a database (such as Firestore.) This field is optional and can be null.

  • createdAt: This is a DateTime object that represents the date and time when the todo item was created.

  • title: This is a string that represents the title of the todo item.

  • isReminder: This is a boolean that indicates whether the todo item has a reminder set or not.

  • isDone: This is a boolean that indicates whether the todo item is completed or not.

  • notificationId: This is an integer that is used to store the notification ID of the todo item. This field is optional and can be null.

Code

Let’s look at the code below:

Get hands-on with 1200+ tech skills courses.