A tour of the Dart Language

Dart Programming Tutorial - 05 Variables And Comments

A Basic Dart Program

/* A Basic Dart Program */

// defining a function

printInteger (int aNumber){
  print('The integer number is :$aNumber'); // print to the console
}

main(){
  var number = 42;
  printInteger(number);
}

image-20200812100844582

  • // comment

Important Concepts

  • Everything is an object. All objects inherit from the Object Class.
    • Every object is an instance of a class.
    • functions are object
    • null is object.
  • Dart is stronly typed.
    • type annotations are optional.

Keywords

Variables

Default Value

Final and Const

Built-in Types

Numbers

Strings

Booleans

Lists

Sets

Maps

Runes and Grapheme Clusters

Symbols

Functions

Operational Parameters

The main() Function

Functions as First Class Objects

Anonymous Functions

Lexical Scope

Lexical Clousures

Testing Functions for Quality

Return Values

Operators

Arithmetic Operators

Equality and Relational Operators

Type Test Operators

Assignment Operators

Logical Operators

Bitwise and Shift Operators

Conditional Expressions

Cascade Notation (..)

Other Operators

Control Flow Statements

if and else

For Loops

While and do-while

Break and Continue

Switch and Case

Assert

Exceptions

Throw

Catch

Finally

Classes

Using Class Members

Using Constructors

Getting an Object’s Type

Instance Variables

Constructors

Methods

Abstract Classes

Implicit Interfaces

Extending a Class

Extension Methods

Enumerated Types

Adding features to a class: mixins

Class variables and methods

Generics

Why use generics?

Using collection literals

Using Parameterized Types with Constructors

Generic Collections and the Types the Contain

Restricting the Parametirized Type

Using Generic Methods

Libraries and Visibility

Using Libraries

Implementing Libraries

Asynchrony Support

Handling Futures

Declarning Async Functions

Handling Streams

Generators

Callable Classes

Isolates

Typedefs

Metadata

Comments

Single-line Comments

Multi-line Comments

Documentation Comments