Null Aware Operators in Dart Programming

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

476 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

337 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

811 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

Mixins in Dart Programming

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

2K+ Views

Mixins in Dart are a way of using the code of a class again in multiple class hierarchies. We make use of the with keyword followed by one or more mixins names.Mixins can be used in two ways, the first case is when we want to make use of class code in such a way that the class doesn't have any constructor and the object of the class is extended. In such a case, we use the with keyword.Another case is when we want our mixin to be usable as a regular class, then we make use of the mixin keyword ... Read More

Loops in Dart Programming

Mukul Latiyan
Updated on 21-May-2021 13:13:42

376 Views

For loop is a type of definite loop in nature. There are mainly two types of loops that Dart provides us. Mainly these are −For loopFor-in loopWe will explore both of these loops in the below post.For loopFor loop in Dart follows a standard structure of the for loop that is present in C++ or Java. The structure of for loop in Dart looks something like this −Syntaxfor (initialization; condition; step) {    // Statements }ExampleConsider the example shown below - Live Demovoid main() {    for (int i = 0; i < 5; i++) {       print('TutorialsPoint : ... Read More

Methods in Dart Programming

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

957 Views

A method is a combination of statements which is used to attach some behavior to the class objects. It is used to perform some action on class objects, and we name methods so that we can recall them later in the program.Methods help in making the core more modular and in increasing the re-usability of the program.Information can be passed to methods through the parameters and then it can perform some operation on that information or it can even return values.Methods in a class are of two types, these are −Instance methodsClass methodsInstance MethodsInstance methods are methods that are present ... Read More

Method Overriding in Dart Programming

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

914 Views

We know that we can access the methods that are present in the superclass from a subclass by making use of the super keyword or by simply creating objects of the subclass. Though, there may be different occasions when we want the subclass object to do things differently to the same method when invoked using subclass objects. We can achieve this by defining the same method again in the subclass with the same name, same arguments and same return type as in the same method that is present inside the superclass.Now, when we invoke that method, the method present in ... Read More

Advertisements