From the course: Dart Clean Code: Writing High-Efficiency, Maintainable Dart Programs

Unlock the full course today

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

Solution: Create a customer class

Solution: Create a customer class

(upbeat music) - [Instructor] Sharing the solution to the challenge, I have created a class called Customer. In this class, I have three variables, customerFirstName, customerLastName, and customerAddress. First and foremost, let us create our Setters. I created a set function for firstName, lastName, and address using the set keyword. For the getters, I used to get keyword in conjunction with the return data type string for the firstName, lastName, and address. The parameters must now be passed to the constructor. This is due to the fact that we must pass values to the class when creating a new instance of the class Customer. As a result, I've made all three variables required. Okay, I've written a function that returns the customer's full name. I used interpolation to concatenate two strings. I've also written a function that returns the customer's ID. In this case, zero was returned as a dummy value. Let's create an…

Contents