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
| All you need to do in this exercise is replace the TODO comments with either ?? or ??=. | |
| Read the codelab text to make sure you understand both, and then give it a try. |
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
| This exercise is fairly straightforward. Just add a list, set, or map literal after each equals sign. | |
| See the codelab text for the correct syntax to use. |
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
| Two assignments that need to happen: letterOne should be word[0], and letterTwo should be word[1]. |
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
| // Say the timestamp in the Travis log looks like this: | |
| // | |
| // travis_time:end:22889f10:start=1559926540498807523,finish=1559926542012374871,duration=1513567348 | |
| // | |
| // This program prints the time in local and UTC time zones. | |
| main() { | |
| int build = (1559926542012374871.0/1e6).toInt(); | |
| var buildDateTime = DateTime.fromMillisecondsSinceEpoch(build); | |
| print('Local time: $buildDateTime'); |
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
| RaisedButton( | |
| child: Text('Click me'), | |
| onPressed: () { | |
| final myFuture = http.get('https://example.com'); | |
| myFuture.then((response) { | |
| if (response.statusCode == 200) { | |
| print('Success!'); | |
| } | |
| }); | |
| }, |
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
| RaisedButton( // (1) | |
| child: Text('Click me'), | |
| onPressed: () { // (2) | |
| final myFuture = http.get('https://example.com'); | |
| myFuture.then((response) { // (3) | |
| if (response.statusCode == 200) { | |
| print('Success!'); | |
| } | |
| }); | |
| }, |
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
| RaisedButton( | |
| onPressed: () { | |
| final myFuture = http.get('https://my.image.url'); | |
| myFuture.then((resp) { | |
| setImage(resp); | |
| }); | |
| }, | |
| child: Text('Click me!'), | |
| ) |
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() { | |
| final myFuture = Future(() { | |
| return 12; | |
| }); | |
| } |
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() { | |
| final myFuture = Future(() { | |
| print('Creating the future.'); // Prints second. | |
| return 12; | |
| }); | |
| print('Done with main().'); // Prints first. | |
| } |
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
| final myFuture = Future.delayed( | |
| const Duration(seconds: 5), | |
| () => 12, | |
| ); |