Relational Operators in Dart Programming

Mukul Latiyan
Updated on 24-May-2021 11:55:54

612 Views

Relational operators are used in cases where we want to compare two operands. The result when we use a relational operator between two operands is always a Boolean value.There are different types of relational operators present in Dart. In the table shown below all the relational operators present in dart are mentioned.Let's take a case where we have two variables x and y, with values 20 and 30 respectively.Consider the table shown below as a reference −OperatorDescriptionOutput>Greater thanx > y = false=Greater than or equal tox >= y = false

Read and Write Input in Dart Programming

Mukul Latiyan
Updated on 24-May-2021 11:55:32

2K+ Views

Dart provides us with a standard library named 'io' which contains different classes and in turn, these classes contains different methods that we can use to read or write input from the terminal.We import the library in our program by making use of the import command.ExampleConsider the example shown below −Import 'dart:io';Writing something to the terminalWe can write something to the terminal by making use of the standard out class (stdout) that is available to us in the 'dart:io' library.ExampleConsider the example shown below − Live Demoimport 'dart:io'; void main(List arguments) {    stdout.write('What is your name?\r'); }OutputWhat is your ... Read More

Queue in Dart Programming

Mukul Latiyan
Updated on 24-May-2021 11:55:04

321 Views

A queue is a collection of objects. In Dart, we can do operations on both ends of the queue.A queue can be created by making use of the Queue class this present inside the collection library of dart.ExampleConsider the example shown below − Live Demoimport 'dart:collection'; void main() {    var queue = new Queue();    print(queue); }In the above example, we imported the collection library so that Queue class can be used from it and then we create a Queue and store it in a variable named queue, and finally we print whatever is inside the queue variable.Output{}We can add ... Read More

Optional Parameters in Dart Programming

Mukul Latiyan
Updated on 24-May-2021 11:54:25

6K+ Views

Optional parameters are those parameters that don't need to be specified when calling the function. Optional parameters allow us to pass default values to parameters that we define. There are two types of optional parameters, mainly −Ordered (positional) optional parametersNamed optional parametersOrdered Optional ParametersOrdered optional parameters are those parameters that are wrapped in [ ]. For example, void printSomething(int a, int b, [ int c = 10] ){    // function body }They give us the freedom to call the function with or without the third parameter.ExampleConsider the example shown below − Live Demovoid printSomething(int a, int b, [ int c ... Read More

Null Aware Operators in Dart Programming

Mukul Latiyan
Updated on 24-May-2021 11:53:55

485 Views

Dart has different null aware operators that we can use to make sure that we are not accessing the null values and to deal with them in a subtle way.Mainly, these are −?? operator??= operator? operatorWe will go through each of them in the following article.?? operatorThe ?? operator returns the first expression if and only if it is not null.ExampleConsider the example shown below −void main() {    var age;    age = age ?? 23;    print(age);    var name = "mukul";    name = name ?? "suruchi";    print(name); }In the above example, we declared two ... Read More

Maps in Dart Programming

Mukul Latiyan
Updated on 21-May-2021 13:20:37

351 Views

Maps are very important data structures as they allow us to map keys to some specific values, and later we can get the values from the keys.In Dart, we have different types of maps available to us. These mainly are −HashMapLinkedHashMapSplayTreeMapIn most cases, we make use of LinkedHashMap as it is very easy to create and make use of.Let's create a simple map in dart.ExampleConsider the example shown below − Live Demovoid main() {    var colors = new Map();    print(colors); }In the above example, we created an empty map and then printed it out. It should be noted that ... Read More

Arithmetic operators in Dart Programming

Mukul Latiyan
Updated on 21-May-2021 13:18:14

825 Views

Arithmetic operators are used to perform different arithmetic operations.These arithmetic operations mainly are −AdditionSubtractionMultiplicationDivisionModulus, etc.Let's consider that we have two int variables named x and y, where x is storing the value 10 and y is storing the value 20.In the below table, you can see all the arithmetic operators, with their symbol, name, what output they yield etc.Consider the table shown below −OperatorNameDescriptionOutput+AdditionAddition of two or more operandsx + y = 30-SubtractionSubtraction of the second operand from the firstx - y = -10*MultiplicationMultiplication of two or more operandsx * y = 200/DivisionReturns quotient after divisionx / y = 0.5%ModulusReturns ... Read More

Inheritance in Dart Programming

Mukul Latiyan
Updated on 21-May-2021 13:16:52

5K+ Views

Inheritance in dart is defined as the process in which one class derive the properties and characteristics of another class. It is helpful as it provides an ability with which we can create a new class from an existing class.Inheritance is a major component of a programming paradigm known as OOPS (Object-Oriented Programming).With the help of Inheritance, one class can make use of all the properties and characteristics of another class.In general, two classes are required for inheritance and these mainly are −Parent class - A class that is inherited by the other class is known as the parent class. ... Read More

Assignment operators in Dart Programming

Mukul Latiyan
Updated on 21-May-2021 13:16:05

1K+ Views

We make use of assignment operators whenever we want to assign values to a variable. There are times when we combine assignment operators with arithmetic operators and logical operators to build a shorthand version of both the assignment and arithmetic (or logical) expression. These shorthand versions are also known as compound statements.In the table below, all the assignment operators that are present in dart are mentioned.Consider the table shown below −OperatorDescriptionExpression=Assignment operatora = b+=Add and assign combineda += b is equivalent to a = a + b-=Subtract and assigna –= b is equivalent to a = a - b*=Multiply and ... Read More

MultiLevel Inheritance in Dart Programming

Mukul Latiyan
Updated on 21-May-2021 13:15:12

1K+ Views

Multilevel inheritance in dart is the case when different classes are inheriting in a form of chain, i.e., one class extends some parent class, and the other class extends the class that was extending the parent class.The syntactical representation of multilevel inheritance looks something like this −class A {} class B extends A {} class C extends B {}If we notice the above syntax, we can clearly see that the class A is the parent class for the class B, which is extending it. Also, the class B acts as a parent for class C, which is extending class B.Multilevel ... Read More

Advertisements