Last active
May 9, 2017 21:02
-
-
Save zidenis/d04c2060ae1a405cebd105259c49cab7 to your computer and use it in GitHub Desktop.
runtimeType behaviour
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
void main() { | |
String s = "Dart"; | |
print(s is String); // true | |
print(s.runtimeType); // String | |
Dart d = new Dart(); | |
NotDart nd = new NotDart(); | |
print(d is Dart); // true | |
print(nd is Dart); // false | |
print(nd is NotDart); // true | |
print(nd.runtimeType); // Dart | |
print(d.runtimeType == nd.runtimeType); // true | |
} | |
class Dart {} | |
class NotDart { | |
Type get runtimeType => Dart; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment