Learn Dart 2 in 90 minutes | Aakash N S | Skillshare

Playback Speed

  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

41 Lessons (51m)
    • 1. Introduction

    • 2. DartPad

    • 3. Variables: initialization and assignment

    • 4. Variables: null, final and const

    • 5. Data types: numbers

    • 6. Data types: strings

    • 7. Data types: booleans

    • 8. Data types: lists

    • 9. Data types - maps

    • 10. Functions: implementation and usage

    • 11. Functions: optional parameters and default values

    • 12. Functions: the main() function

    • 13. Functions: functions as objects

    • 14. Functions: anonymous functions

    • 15. Functions: lexical closures

    • 16. Functions: return values

    • 17. Operators: arithmetic

    • 18. Operators: equality and comparison

    • 19. Operators: type test

    • 20. Operators: assignment

    • 21. Operators: logical

    • 22. Operators: bitwise and shift

    • 23. Operators: conditional expressions

    • 24. Control flow: if-else

    • 25. Control flow: for loops

    • 26. Control flow: while and do-while loops

    • 27. Control flow: break and continue

    • 28. Control flow: switch-case

    • 29. Exceptions: throw

    • 30. Exceptions: try-catch

    • 31. Exceptions: finally

    • 32. Classes: definition and instantiation

    • 33. Classes: constructors

    • 34. Classes: methods

    • 35. Classes: abstract classes

    • 36. Classes: implicit interfaces

    • 37. Classes: subclassing and overriding

    • 38. Classes: enumerations

    • 39. Classes: static variables and methods

    • 40. Summary

    • 41. Next steps: where to go from here?

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.





About This Class

Dart is a programming language by Google that has been gaining a lot of traction recently and is one of the most sought after skills in 2018. It is a general purpose language that can be used for developing command line tools, web servers, web applications (using AngularDart) and cross-platform mobile applications (using Flutter).

This is a course for programmers looking to learn Dart 2.0 quickly and start using it immediately. Following topics are covered in the course:

1. Variables

2. Data Types

3. Functions

4. Operators

5. Control Flow

6. Exceptions

7. Classes

Some basic programming knowledge is assumed.

Meet Your Teacher

Teacher Profile Image

Aakash N S

Software Consultant & Entrepreneur


I'm a Software Consultant and Entrepreneur. I've worked extensively on dozens of products and technologies with teams around the world, including Silicon Valley, Japan, Germany, Israel and India. As an entrepreneur I've launched multiple products that have gone on to acquire 100s of thousands of users. Teaching is my passion, and I often conduct workshops for emerging technologies I'm interested in. I also like to write blogs and develop open source software in my free time.

See full profile

Class Ratings

Expectations Met?
  • Exceeded!
  • Yes
  • Somewhat
  • Not really
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.


1. Introduction: Hi and welcome to this online course on Dart Dart is a programming language by Google that has been getting a lot of flexion in the recent months. This is where dark cord looks like, and this is the official language website off start www door Dark Langert. You can view the documentation and guidelines and tutorials for the language here. Start can be used on the silver or on the front end for creating websites using angular dark. You can find it on Web or dark language. Dark can also be used to create beautiful new traps, cross platform apps that turn on both our U S and Android and incorporate all the neuter functionalities using flooded. In this course, people go over the basics of dark. Here are some of the topics we will cover in this course. You start with a discussion on variables, then data types and functions. Operators control flow exceptions and close with a discussion on classes and dark in just 90 minutes. Really get up to speed with all the important topic topics and Dr Point and you'll be able to start using dark 2. DartPad: for this course, we will be doing all the Corning in dark bag. It is an online editor where you can type and run dark court to open a new doctor bird Visit the site. Dark, bagged or dark language work. This is what a hello world program in dark looks like. There is a main function, which is the entry point for every dark program. You can have some comments and you can have statements inside. The main function one by one will go where all those topics inside off a dark bag without requiring any additional sector. Let's get started. 3. Variables: initialization and assignment: variables and dart store references to objects. Here is an example of creating an initializing a very well. The type of variably is in four to a string, and it can be changed to another value of the same type As you can see here, I get an error. When I tried to assign the number 34 to a, the type of a variable can also be declared explicitly. If you want available to have a flexible time that can be changed at run time. Use the keyboard dynamic as you can see we do nor getting better. 4. Variables: null, final and const: un initialized. Variables and dart haven't initial value off. Now they just look at an example. Even numeric variables have the initial value off. No, because numbers just like everything else in dark but also objects. If you never intend to change the value of variable, you can use the final or constant you'd let's look at an example. As you can see here, we get another. When we tried to reassign X Final keyword can also be used in conjunction with the type the keyboard, Const is used to create a compile time constant and work similar to find her. As you can see here, we get another when we try to reassign bar. The final key word can be used for properties within a class, but the constantly work can only be used on static properties. Finally, the constantly work can also be used to declare constant values for a raise. Maps, etcetera 5. Data types: numbers: numbers and dark come in two flavors in teaches and doubles impeaches a number. The daughter decimal point here is an example off defining any huge it indeed. Just, you know, so gratifying Using the hex a decimal representation here is an example of defining a double doubles Our numbers with our decimal point both intangible are subtypes of the type . Now here is an example of defining enough. As you can see, a numb can be reassigned from money and seizure toward double and right. See Rosa finally, Let's look at how we can create numbers from strings and strength from numbers. This is how we cleared and from a string. And this is all we cleared a string number double. 6. Data types: strings: strings and dark are sequences off UT of 16 Cordy owners. Strings can be created either using single or double courts. Here is an example with single courts, and here is an example of her double cooks. Strings can be joined using the plus operator. Any object in dark can be converted to string using the two string method of the object. Here, we're using the shoestring method on a list. Finally, you can use any available or expression inside a string using the string interpolation operation. Let us look at an example as you can see here, this string interpolate the value off white less they're going to do and Prince 1 24 7. Data types: booleans: to represent billions. Dart has a type called bull. Only dual use have this type true and false. A 1,000,000,000 can also recreated from an expression. It is a condition, nor that, unlike some other languages, Dark does not have a concept off fruity or false values. That is, you cannot treat the empty string zero no or other such values as false. 8. Data types: lists: A list, also known as Array, is an ordered collection of objects. Here is how we create a list. The elements of a list are indexed from zero and can be accessed using square brackets. The seams impacts can also be used to assign the value of the particular index. The length of a list can be accessed using the Dart Lands property. We can add values to a list using their daughter admitted. If you want to create a list that cannot be mortified, use the constant you word. As you can see here, we get an exception at this point. 9. Data types - maps: a map is an object that associates keys with values. Both keys and values can be any type of object. Each key occurs only once, but you can use the same value multiple times. Here is an example of creating a map. You can also create the map using the new map keywords. The elements off a map can be accessed using square brackets, Detroit in the keys and the legs. The same syntax can also be used to set values or new values. If you try to access a key that is not present in the map, you get back another. Finally, you can use dark length to get the number of key value pairs in the map. 10. Functions: implementation and usage: since dark is an object oriented language. Even functions are objects and have a type function. This means that functions can be assigned to variables or Oska's arguments to other functions. Here is an example of implementing a function. As you can see a function has a don't die has some arguments which also have types and contains at a done statement you can also have some intermediate statements. It is an example off using a function. 11. Functions: optional parameters and default values: functions and dark can have optional parameters were default values. If no default value was specified, the optional parameter gets a before value off. No option parameters can either be positional or named, but not book. Let's take an example off dividing the function with named Dynamic does, as you can see named Parameters, are specified using curly braces and can be provided it a default value. They're just looking. Look at an example off calling a named parameter function. As you can see, the total sum is to last three, the seven for their and do for a there is no look at an example off, creating a function with a positional optional parameter. - Their issues dysfunction without specifying one of the positional parameters. Again, As you can see, seven is taken as a value for is there and who is taken as a value for it. No doubt here we do not need to specify the name of the parameter 12. Functions: the main() function: every dart up must have a top level main function, which serves as the entry point to the the main function returns word and has an optional list of strings as a parameter for arguments. In fact, we have been using the main function all along. In this course, any statement that we don't read typically died inside the main function. Also, as we have seen, we can define functions are said, the main function and use them within the mean functions. You'll see that if we read the same court outside the main function, it would not get executed and will lead to an edit. As mentioned before come on line ups can typically also receive a string of arguments here . The string off argument is actually an empty list because there are no arguments past inside dark. 13. Functions: functions as objects: functions and dark our first class objects, which means they can be passed as a parameter toe, another function or assigned to available. They just look at an example of this. The function print element takes a number and prints it out with a new line. Now let us pass it as an argument toe the for each method off a list which executes the given function for each element of the list. As you can see, each element of the list is printed along with a new life. We can also assigned the function into a new very but 14. Functions: anonymous functions: in dark. We can also create functions without names called Anonymous Functions or Lambda Functions. We can assign anonymous functions two variables so that, for example, we can add or remove it from a collection and anonymous function. Looks similar to a named function but does not contain any. Let us took look at an example in this example of even passed an anonymous function toe the for each method of the list. Here we are using an anonymous function to print are each element of the list along with the index. If function contains only one statement, then we can shorten it further. Using a fact, Adam notation let us see how to do that. As you can see, we don't need the curly braces and we can provide a single statement in life. 15. Functions: lexical closures: a closure is a function object that has access to variables in its lexical scope. Even when the function is used outside of the original school, functions can close over variables defined its that our next corpse, such as in this example the function make out that it don's a function which guards I'd buy to the functions. Argument notice. Look at an example Usage as you can see the functions Act two and act for have access to the respective art by Variables Boston is arguments to make at. 16. Functions: return values: all functions and dart return a value. If Nora Dunn value is specified. The statement return now is implicitly appended to the function body. They're just see this as an example. 17. Operators: arithmetic: Dart has support for all the common arithmetic operations. Let us look at some examples the add subtract and negation operators book. As expected, the multiply and divide operators automatically cast numbers into 14 points. The caution operator always returns. And a teacher, I mean, that operator also turns in teaching Inclement and Dick Clement book as expected. 18. Operators: equality and comparison: Dart also has standard operators for equality and comparison as you can see the return true or false, based on the competitive. 19. Operators: type test: dark also has operatives to check the type off available at one time. Now let's check the type of this list. Using the is operate as you can see a different story. We can also use the is not operator to do the opposite. Finally, we can use the as operator the cost available to a particular type. If you use the wrong type here, you could get an exception. 20. Operators: assignment: we have already seen the assignment operator equals. In addition, that also has another operator which can be used to assign toe available. Leave the variable is not, for instance, the value of the remains five in this example. But if it's day we create a new variable B and assigned to it in the value of B becomes six . Finally, Dart also has the concept of a components and made where you can see historic ones too. You mean the same thing as equals if they start 21. Operators: logical: DOT also has the logical operators or and not. 22. Operators: bitwise and shift: We can also manipulate the individual bits off a number and dart. Usually we use thes bit ways, operators within teachers. Then let's look at some examples. This is the big ways, or and this is a bit wise and it is the exclusive or and this is the big Twice compliment, which turns all the one bits into zeros and all the zero bits into one. This is the ship left operator, which moved the bits to the left with a given amount. Similarly, this is the shift right operator, which moved the bridge to the right and drops anyone's did. 23. Operators: conditional expressions: Dart has two operators that let us concisely evaluate expressions that might otherwise require in defence. Statement. What is news here? We have a list of prime numbers on the kind of number to check whether the display we conduct a single statement. It starts with the condition and then a question mark and then two expressions separated by a cool. The condition is true. The first expression is returned, otherwise the second Expressionist return. Similarly, we can also check if an expression is now with the double equals double question marks. Operator. Here we have a list of noble gasses in a map on DA candidate atomic numbers. In this case, since noble guesses for the 11 returns, no, we can't back this expression on the other hand, with a cute, then we get back the actual value. 24. Control flow: if-else: just like other languages. Start supports the if statement with optional else. If and else blocks, let's look at an example as expected, this line of court parents between five and seven, you can change the value effects and see how the other branches are evaluated. 25. Control flow: for loops: for alteration and dark we can use the standard for Luke here doesn't exactly As you can see, this takes each element of the list and printed out formatted inside the street. If the object retreating through is is in a terrible object, like a list on a map, and we can also use the foreign look. As you can see, we get the same result with some shorter cold. 26. Control flow: while and do-while loops: Dart also has support for a while, and Dubai loops in a vile Luke. The condition is evaluated before Luke, as expected, the sprints the number zero tonight in a door while the condition is evaluated after the look. 27. Control flow: break and continue: we can use the brake statement to stop the execution of Palu. Midway. They're just look at an example here. We'll break ordered to do if I becomes divisible by fires as expected, Disappearance The numbers. 11 12 13 and 40 We can also use Continue toe, continue execution of the loop and skip the remaining statements inside. I just looked in example here We skipped the print statement every time I becomes divisible by two. 28. Control flow: switch-case: we can use the switch statement to compare a value against antigens, string or compile time constants. Inside the switch statements, we can have multiple cases. Now let's look at an example. The statement looks at the value of day and compares it to Saturday and Sunday. And if neither of the values matches, it drinks big as expected, this court prints weekday. If we change the value of their to Sunday it prints weekend. 29. Exceptions: throw: dark core can throw and catch exceptions. Exceptions are editors indicating that something unexpected has happened. If an exception isn't guard on, the program can be terminated. Let us look at an example off throwing an exception. - If the functions some is involved with no values, it throws an exception. On the other hand, if it is involved with proper values, we do not get an exception. 30. Exceptions: try-catch: we can use the try catch block to capture, exception and handle it. They're just look at an example as you can see, the exception and the stack days are printed here. 31. Exceptions: finally: to ensure that some cordons, whether or not an exception, is thrown, we can use a finally clause if no catch close matches. The exception. The exception is propagated after the finally close runs. Now let's look at an example. As you can see, the statement could not artist printer, and then the exception is propagated. 32. Classes: definition and instantiation: Dart is an object oriented language with classes and mixing based inheritance. In this section, we learn about classes and dark. Every object in dark is an instance of a class. All classes descend from the class called object. Here's how we can declare a class inside a class. We can have one or more instance video votes. Their default value is no, and they can be initialized to a value. Here is how we can create an object of the class. 33. Classes: constructors: we can send the properties off instance Rivers, right when classes to find We can do that using a constructor constructor is declared by creating a function with the same name as it's close. Here is an example. Here is how we can use the constructor now because despite and it's so common, there's a short time for this and dart this court has the same behavior. You can also use a named constructor to implement my tipple constructors for a class or provide one for extra clarity. For example, here is a name constructor called Origin, and here is that we can use it. 34. Classes: methods: instance, matters are functions that provide behavior for an object. It's just methods. Have access to the instance variables off a close. They're just look at an example. - The method distance to takes a point and returns the distance of the given point from the orders. New point. They just look a usage of this I met there. 35. Classes: abstract classes: an abstract class is a class that cannot be in Stan Shooter. It can only be extended and implemented by other classes. An abstract method is a method that does not contain an implementation and needs to be defined by sub classes. Here is an example of an abstract class and method. You can see that when we try to instant shooter, it will be done and editor. 36. Classes: implicit interfaces: what every class and dark implicitly defines an interface containing all the instance members of the class and of any interface it implements. If you want to create a class A that supports class, bees appear without inheriting bees implementations classes, your implement being to face. They're just look at an example. Here we have a class person which contains a very bill in name a constructor and emitted greet. When the implementing interface we will inherit Put the name field on the greed constructor here is an implementation and here is how we can use the new implementation. 37. Classes: subclassing and overriding: dark makes it really easy to extend classes and override their methods. Here we have a classic tangle with instant variables ripped and high in a constructive. It also contains a method diagnosed Mr Turns. The length of the Dagnall of direct anger that does X turn this glass for the constructor weaken simply involved the super constructor from the rectangle. Override the diagonals matter used the override cured. Let's try it out. 38. Classes: enumerations: and you military types offered gold enumeration. Zor in terms are a special kind of class used to represent a fixed number of constant values. Here is how we can declare an in, um, and here is how we can use an enough. We can also access the index, often element inside angina. You can also get a list of the values inside of me by using the command in a named. Our values in terms are commonly used inside switch case statements. 39. Classes: static variables and methods: we can use staticky were to define class fired variables and methods. Here is an example of a static variable and here is an example off a static method. - Here is how we can use the static, variable and metal. 40. Summary: you have now completed the scores. Here is a brief summary of the topics covered. We started with an introduction to variables and Dart and looked at some live examples in dark back. After that, we moved on to look at the release data types built into dart like numbers, strains, BoDeans, map list, etcetera. Then we looked at functions how to create them, how to implement them and how to pass them around as first class objects. After that, we looked at medical operators, logical operators and other different kinds of operators. Then we had a discussion about the control flow statements like if s which case, Dubai. Bye, etcetera. We also discussed exceptions using and handling them using Try catch finally And as the final topic, we looked at classes and start. I hope these lectures have been useful to you. You can always come back and watch them again. If you're in doubt 41. Next steps: where to go from here?: Now that you're familiar with the basics of Dart, you can move on and start using it in practical projects. Depending on the use case you have in mind, you have several options. If you're looking to create an app for mobile phones that runs on both IOS and Android flight, it is a good place to start. So here is the official website of selector, and you can follow the overview instructions, which walk you through the installation configuration of the director and writing your first step. If you're looking to breed of ever. The angular dart is the place where you want to go here again. You can play around with the features and dark bag and start building with applications with dark. Finally, if you're looking to create a command line tool or a server with Dart, then you have instructions on the Oprah Show of Upstart What an I D. You can use any editor of your choice or the recommended ones, which include Intelligent Idea Visual Studio called and endorsed earlier. That's it for this course. I hope to see you again in other courts on dark. Thank you