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() { | |
| var x = [ | |
| "a", | |
| "", | |
| "foo", | |
| "bar", | |
| "foo", | |
| ]; | |
| print("Before:\t x is ${x}"); | |
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() { | |
| var items = ["a", "b", "c", "d", "e"]; | |
| var i = 2; | |
| var j = 4; | |
| items.removeRange(i, j); | |
| print(items); | |
| } |
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{ | |
| String engine = ""; | |
| } | |
| void main() { | |
| Map<Foo, int> m = {}; | |
| var k = Foo(); | |
| k.engine = "Rocket Lab"; | |
| var v = 42; |
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() { | |
| var a = [4, 5, 6, 7, 8, 9, 10]; | |
| var b = [1, 3, 9, 5, 7, 9, 7, 7]; | |
| var c = {...a,...b}; | |
| print(c); | |
| } |
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() { | |
| var s = "Let's dance the macarena"; | |
| { | |
| var word = "Dance"; | |
| bool ok = s.toUpperCase().contains(word.toUpperCase()); | |
| print(ok); | |
| } | |
| { | |
| var word = "dance"; |
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
| import 'dart:convert'; | |
| void main() { | |
| var s = "Résumé"; | |
| var n = utf8.encode(s).length; | |
| print("$n bytes"); | |
| } |
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() { | |
| var m = { | |
| "one": 1, | |
| "two": 2 | |
| }; | |
| print(m); | |
| } |
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() { | |
| var x = { | |
| "one": 1, | |
| "two": 2 | |
| }; | |
| print(x); | |
| } |
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() { | |
| print("Hello"); | |
| // This is a comment | |
| print("World"); | |
| } |
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
| enum Suit { | |
| SPADES, | |
| HEARTS, | |
| DIAMONDS, | |
| CLUBS, | |
| } | |
| void main() { | |
| print(Suit.DIAMONDS); | |
| } |