Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jodinathan/2d17d3d4cfaa18afb7e75e57dc770786 to your computer and use it in GitHub Desktop.
Save jodinathan/2d17d3d4cfaa18afb7e75e57dc770786 to your computer and use it in GitHub Desktop.
class Complex {
num _real;
num _imaginary;
num get real => _real;
num get imaginary => _imaginary;
set real(num r) {
if(r < 0) return;
_real = r;
}
}
void main() async {
var a = Complex();
a.real = 123;
print(a.real);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment