Category: 02. Dart

  • Lists

    A very commonly used collection in programming is an array. Dart represents arrays in the form of List objects. A List is simply an ordered group of objects. The dart:core library provides the List class that enables creation and manipulation of lists. The logical representation of a list in Dart is given below − Lists can be classified as − Let us…

  • Boolean

    Dart provides an inbuilt support for the Boolean data type. The Boolean data type in DART supports only two values – true and false. The keyword bool is used to represent a Boolean literal in DART. The syntax for declaring a Boolean variable in DART is as given below − Example It will produce the…

  • String

    The String data type represents a sequence of characters. A Dart string is a sequence of UTF 16 code units. String values in Dart can be represented using either single or double or triple quotes. Single line strings are represented using single or double quotes. Triple quotes are used to represent multi-line strings. The syntax…

  • Numbers

    Dart numbers can be classified as − The num type is inherited by the int and double types. The dart core library allows numerous operations on numeric values. The syntax for declaring a number is as given below − Example It will produce the following output − Note − The Dart VM will throw an exception if fractional values are assigned to integer variables. Parsing The parse() static…

  • Decision Making

    A conditional/decision-making construct evaluates a condition before the instructions are executed. Conditional constructs in Dart are classified in the following table. Sr.No Statement & Description 1 if statementAn if statement consists of a Boolean expression followed by one or more statements. 2 If…Else StatementAn if can be followed by an optional else block. The else block will execute if the Boolean expression tested by…

  • Loops

    At times, certain instructions require repeated execution. Loops are an ideal way to do the same. A loop represents a set of instructions that must be repeated. In a loop’s context, a repetition is termed as an iteration. The following figure illustrates the classification of loops − Let’s start the discussion with Definite Loops. A loop…

  • Operators

    An expression is a special kind of statement that evaluates to a value. Every expression is composed of − Consider the following expression – “2 + 3”. In this expression, 2 and 3 are operands and the symbol “+” (plus) is the operator. In this chapter, we will discuss the operators that are available in Dart. Arithmetic Operators…

  • Variables

    A variable is “a named space in the memory” that stores values. In other words, it acts a container for values in a program. Variable names are called identifiers. Following are the naming rules for an identifier − Type Syntax A variable must be declared before it is used. Dart uses the var keyword to…

  • Data Types

    One of the most fundamental characteristics of a programming language is the set of data types it supports. These are the type of values that can be represented and manipulated in a programming language. The Dart language supports the following types− Numbers Numbers in Dart are used to represent numeric literals. The Number Dart come…

  • Syntax

    Syntax defines a set of rules for writing programs. Every language specification defines its own syntax. A Dart program is composed of − Your First Dart Code Let us start with the traditional “Hello World” example − The main() function is a predefined method in Dart. This method acts as the entry point to the application. A…