Programming in Dart: Fundamentals
Apr 26 2022 · Dart 2.15, DartPad, DartPad
Part 1: Fundamentals
Notes: 01. Introduction
Hey what’s up everybody! This is Brian and welcome to Programming in Dart! In this course, you’ll gain a really solid understanding of how to program in the Dart language. Specifically, you’ll learn all of the fundamental concepts you need to know to program in Dart, such as operators, types, classes, collections, null safety, functions, and more.
Before you begin this course though, I recommend you start by watching our Your First Flutter App course, if you haven’t already. That course is included with your raywenderlich.com subscription, and it gets you started with Dart and Flutter development by making a simple but fun app, and learning some basic Dart concepts along the way. This course picks up where that course leaves off.
If you’ve already completed the Your First Flutter App course, you’ve actually already learned a lot about Dart programming while building your app. Specifically, you’ve learned about four major concepts in Dart:
Number 1. You should know how to use variables and constants, and what the difference is. Remember - you use
var for variables, and
const for constants.
Number 2. You should know how to use data types like Ints and Strings. For example, here’s my age as an Int, and my name as a String. Note that these are written in the long form here, for clarity, but you could use Dart’s type inference to write these without the types if you wanted.
Number 3. You should know how to perform basic operations like adding numbers or incrementing numbers. For example, I can increment my age with +=, or add two numbers together with the + operator.
And finally, number 4: You should know how to use
if statements. Here’s an example of writing an
if statement to check if my dog Cosmos is still a puppy. He may not not a puppy, but he’s still cute!
If you still feel rusty on any of these concepts, that’s OK; you can go back and review the previous course, or you can keep watching because I’ll continue to use these concepts throughout the course.
Okay, in this first part of Programming in Dart, I’m going to almost double your Dart core concepts, by covering three new core concepts in Dart.
You’ll learn how to use Dartpad, a really cool tool that lets you test out code and see the results instantly, and how to use comments to document your code to make it easier to understand.
You’ll also learn about the Boolean data type, which stores a simple true or false value, and about a new set of operators called comparison operators that let you compare values to each other.
I’ll then show you how logical operators work, that you can use.
Then, we will revisit our old friend ‘the if-statement’ and learn how to use to assign values using something known as the ternary operator.
This course is designed to be hands-on, where we’ll explore Dart together step-by-step. It’s very important that you don’t just watch the exercises, but actually follow along in Dartpad. This helps you understand how to write code in the Dart programming language.
In addition, the course contains several hands-on challenges, where you’ll get to practice what you’ve just learned on your own. It’s in your best interest to actually pause the video and try solving the challenges - you’ll learn a ton by doing this.
This course is the first course in a series of four courses that aim to teach you the Dart programming language. Right now, you are here at the beginning. In the next next course, you’ll explore Control Flow as well as some additional collection classes. In the third course, you’ll learn about functions and closures and finally, in the last course, you’ll learn all about classes.
With that said, it’s time to get moving. By the time you’re done with this part of the course, you should have a nice Dart foundation which you can use to dive even deeper into the language. So let’s get started by learning about Dartpad and writing comments.