Created
December 8, 2020 09:38
-
-
Save burakemir/c6ec42e4a1d1d94132a0fc51f61b7365 to your computer and use it in GitHub Desktop.
null safety
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo { | |
covariant double? _zoo = 3.14; | |
set zoo(covariant double? o) {_zoo = o;} | |
double? get zoo => _zoo; | |
} | |
class Bar extends Foo { | |
@override double _zoo = 2.3; | |
@override set zoo(double o) {_zoo = o;} | |
double get zoo => _zoo; | |
} | |
void main() { | |
Foo x = Bar(); | |
x.zoo = null; // Accepted, but will break at runtime. | |
print("Never reached."); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment