Dart Codelab: Dart Cheatsheet
Questions? We have answers.
If you run into problems while doing this codelab, please post to the #codelab-questions channel in Discord.
Task
1. Work through the Dart Cheatsheet Code Lab
For this experience, please go through the Dart Cheatsheet codelab.
During the codelab, you should use the embedded DartPad environment to execute the examples.
Take your time, don’t rush, and make sure you understand every line of code and every sentence in this codelab! Do all of the requested coding! If you have questions or get stuck, post a message to our Discord server.
This codelab introduces a lot of interesting language features I haven’t seen before, including:
- ??= assignment, ?? operator
- null-shorting cascade: ?..
- Initializer lists: good when instance variables are declared as final, so they get a value before constructor body executes.
- Note that “redirecting constructor” syntax looks just like an initializer list, but uses “this” instead.
2. Create a GitHub repo with the Recipe program
When you are done with the codelab, please do the following:
- Create a private GitHub repository called “dart-recipe”. (Add a README to make it easier to clone using GitHub Desktop.)
- Make me a collaborator so I can view your work. My GitHub username is philipmjohnson.
- Clone it to your laptop using GitHub Desktop or equivalent.
- Run “dart create recipe” to create a template Dart application.
- Edit the recipe application to include the (corrected) code from the bottom of the final section of this codelab (“Const constructors”).
- Edit the main() method to create at least one instance of your Recipe class and print out the contents.
- Run your application within IntelliJ IDEA to check your output.
- Commit your changes when finished. (I like to add a top-level .gitignore and ignore the .idea directory.)
Creating this repo provides evidence that you worked on this codelab, and gives you more practice using IntelliJ IDEA for Dart application development, which will be useful soon.
Submission Instructions
By the date and time listed in the Schedule page, please submit the URL to your GitHub repo in Laulima.
Don’t forget to make me (philipmjohnson) a collaborator so I can view your work!