Getter/Setter in Flutter using Android Studio

Posted by Editorial Staff | Updated on

Getter/Setter in Flutter using Android Studio. A field is equivalent to a getter/setter pair. A final field is equivalent to a getter.

You change it only to actual getters/setters if additionally logic is required and this change is non-breaking for users of that class.

Public getter/setter methods for private fields is an anti-pattern in Dart if the getters/setters don’t contain additional logic.


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers