Category: 11. Dart
-
Lists (Basic Operations)
In this chapter, we will discuss how to carry out some basic operations on Lists, such as − Sr.No Basic Operation & Description 1 Inserting Elements into a ListMutable Lists can grow dynamically at runtime. The List.add() function appends the specified value to the end of the List and returns a modified List object. 2 Updating a…
-
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 Live Demo It will…
-
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…