Getters and Setters, also called accessors and mutators, allow the program to initialize and retrieve the values of class fields respectively. Getters or accessors are defined using the get keyword. Setters or mutators are defined using the set keyword. A default getter/setter is associated with every class. However, the default ones can be overridden by explicitly defining a setter/ getter.… Continue reading Dart – Getters and Setters
Tag: dart
Dart – If-else Statement
In Dart, if-block is executed when the given condition is true. If the given condition is false, else-block is executed. The else block is associated with the if-block. Dart if…else Statement Flow Diagram Syntax: Here, if -else statement is used for either types of result TRUE or False. If the given condition evaluates true, then… Continue reading Dart – If-else Statement
Dart – If Statements
If statement allows us to a block of code execute when the given condition returns true. In Dart programming, we have a scenario where we want to execute a block of code when it satisfies the given condition. The condition evaluates Boolean values TRUE or FALSE and the decision is made based on these Boolean… Continue reading Dart – If Statements
Dart – Class
In object-oriented programming, a class is a blueprint for creating objects. A class defines the properties and methods that an object will have. Declaring Class In Dart You can declare a class in dart using the class keyword followed by class name and braces {}. It’s a good habit to write class name in PascalCase. Syntax: The class keyword is… Continue reading Dart – Class
Dart – Keywords
Dart Keywords are the reserve words that have special meaning for the compiler. It cannot be used as the variable name, class name, or function name. Keywords are case sensitive; they must be written as they are defined. There are 61 keywords in the Dart. Some of them are common, you may be already familiar and few… Continue reading Dart – Keywords
Dart – Variable
Variable is used to store the value and refer the memory location in computer memory. When we create a variable, the Dart compiler allocates some space in memory. The size of the memory block of memory is depended upon the type of variable. To create a variable, we should follow certain rules. Here is an… Continue reading Dart – Variable
Dart – Null Safety
Null safety prevents errors that result from unintentional access of variables set to null. Nullable Types (?) : To specify if the variable can be null, then you can use the nullable type operator. You don’t need to initialize a nullable variable before using it. It is initialized to null by default. The Assertion Operator (!) :… Continue reading Dart – Null Safety
Dart – Map
Maps Maps is an unordered pair of key and values. The keys of the map must unique, values can be the same. Map is also called dictionary or hash .The size of a map is not fixed, we can add, delete edit the values of the map. The size of the map depends upon the number of elements in… Continue reading Dart – Map
Dart – Set
Set A set is an unordered collection of values. We can’t get the values by their index values as they are unordered. Values in set are unique i.e. they can’t be repeated. Creating a Set using a constructor: Creating a Set using List Inserting elements in Set
Dart – List
List A list is an array of elements arranged in an ordered sequence. There are two types of List: Fixed-Length List Growable List Fixed-Length List is a list that can’t be changed once initialized whereas the Growable list is dynamic in nature. Fixed-length List Creating a Fixed-length List The indexing value start with 0 and end with listOfLength-1 .… Continue reading Dart – List