The neat thing is, you can add stuff like range checks and logging for getters and setters without changing every call. Separation of concerns is also vital in larger projects.
typical OOP progaganda
I love dart’s approach to getter and setter methods… They let you define methods labelled explicitly as “get” or “set” methods that you can call without writing the parentheses. So the call looks like accessing a member variable, but internally it can handle additional functionality like logging or validation or whatever you want. So the syntax would look like the first example in the meme, but with all the benefits of the second example. I wish more languages would incorporate this
Imagine not using a language with setters and getter built in lol
Every IT profesor, ever