Page 12 - Dart Language
P. 12

bool get isHungry => _isHungry;
           bool set isHungry(bool hungry) => this._isHungry = hungry;
         }


        Dart class getters and setters allow APIs to encapsulate object state changes.

        See dartpad example here: https://dartpad.dartlang.org/c25af60ca18a192b84af6990f3313233


        Read Getting started with dart online: https://riptutorial.com/dart/topic/843/getting-started-with-dart














































































        https://riptutorial.com/                                                                                7
   7   8   9   10   11   12   13   14   15   16   17