Skip to content

Instantly share code, notes, and snippets.

@zidenis
Last active May 9, 2017 21:02
Show Gist options
  • Select an option

  • Save zidenis/d04c2060ae1a405cebd105259c49cab7 to your computer and use it in GitHub Desktop.

Select an option

Save zidenis/d04c2060ae1a405cebd105259c49cab7 to your computer and use it in GitHub Desktop.

Revisions

  1. zidenis revised this gist May 9, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion runtimeType.dart
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    void main() {
    String s = "Dart";
    String s = "Dart";
    print(s is String); // true
    print(s.runtimeType); // String

  2. zidenis revised this gist May 9, 2017. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions runtimeType.dart
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,14 @@
    void main() {
    String s = "Dart";
    print(s is String); // true
    print(s.runtimeType); // String
    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 is Dart); // true
    print(nd is Dart); // false
    print(nd is NotDart); // true
    print(nd.runtimeType); // Dart
    print(d.runtimeType == nd.runtimeType); // true
    }

  3. zidenis revised this gist May 9, 2017. 1 changed file with 13 additions and 8 deletions.
    21 changes: 13 additions & 8 deletions runtimeType.dart
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,19 @@
    void main() {
    String s = "Dart";
    print(s is String); // true
    print(s.runtimeType); // String
    NotDart d = new NotDart();
    print(d is Dart); // false
    print(d is NotDart); // true
    print(d.runtimeType); // NotDart
    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 => NotDart;
    Type get runtimeType => Dart;
    }
  4. zidenis revised this gist May 9, 2017. 1 changed file with 6 additions and 7 deletions.
    13 changes: 6 additions & 7 deletions runtimeType.dart
    Original file line number Diff line number Diff line change
    @@ -1,15 +1,14 @@
    void main() {
    String s = "Dart";
    print(s is String); // true
    print(s.runtimeType); // String
    String s = "Dart";
    print(s is String); // true
    print(s.runtimeType); // String
    NotDart d = new NotDart();
    print(d is Dart); // false
    print(d is NotDart); // true
    print(d.runtimeType); // NotDart
    print(d is Dart); // false
    print(d is NotDart); // true
    print(d.runtimeType); // NotDart
    }

    class Dart {}

    class NotDart {
    Type get runtimeType => NotDart;
    }
  5. zidenis created this gist May 9, 2017.
    15 changes: 15 additions & 0 deletions runtimeType.dart
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    void main() {
    String s = "Dart";
    print(s is String); // true
    print(s.runtimeType); // String
    NotDart d = new NotDart();
    print(d is Dart); // false
    print(d is NotDart); // true
    print(d.runtimeType); // NotDart
    }

    class Dart {}

    class NotDart {
    Type get runtimeType => NotDart;
    }