//rectangle.dart
class Rectangle {
int height;
int width;
Rectangle(this.height, this.width) {}
void area() {
int area = height * width;
print('長方形の面積:$area');
}
}
【Flutter×Dart】クラスのカプセル化|getter/setter今回はDartにおけるクラスの「カプセル化」「getter」「setter」の使い方について解説します。 【カプセル化】 class Person { String _name; int _age; Person(this._n...