From the course: Flutter Essential Training: Build for Multiple Platforms

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Modeling entities in Dart

Modeling entities in Dart

- [Female Voice] Currently, our chat bubble is working with hard coded data. If you notice the text right here and the image right here. Which obviously was a temporary setup to get things rolling, but now we must introduce actual data coming from some source. In order to do that, this widget itself cannot hold any hard coded data. It should receive data from the parent, somehow. Well, there are a few ways to do this. For example, adding the variables in the constructor itself and providing the data from the parent. So, like right now we have message, but we can also add the final string image, URL, final string author name. But if we add more properties like timestamp, author, metadata, et cetera, it becomes hard to maintain the entire list. And this would also be hard to mark later. So, maybe can we create a class called chat message entities and add all the properties there. So, we can directly pass around the…

Contents