The static keyword is used for memory management of global data members. The static keyword can be applied to the fields and methods of a class. The static variables and methods are part of the class instead of a specific instance. The static keyword is used for a class-level variable and method that is the… Continue reading Dart – Static Keyword
Author: Diya S
How to Exit a Dart Application Unconditionally?
The exit() method exits the current program by terminating running Dart VM. This method takes a status code. A non-zero value of status code is generally used to indicate abnormal termination. This is a similar exit in C/C++, Java. This method doesn’t wait for any asynchronous operations to terminate. Syntax: exit(exit_code); To use this method, we have… Continue reading How to Exit a Dart Application Unconditionally?
Splitting of String
In Dart splitting of a string can be done with the help split string function in the dart. It is a built-in function use to split the string into substring across a common character. Syntax: string_name.split(pattern) This function splits the string into substring across the given pattern and then store them to a list. Example1: Splitting… Continue reading Splitting of String
How to Combine Lists in Dart?
In Dart programming, the List data type is similar to arrays in other programming languages. A list is used to represent a collection of objects. It is an ordered group of objects. The core libraries in Dart are responsible for the existence of List class, its creation, and manipulation. These are some ways to combine… Continue reading How to Combine Lists in Dart?
Dart Boolean
Dart Boolean data type is used to check whether a given statement true or false. The true and false are the two values of the Boolean type, which are both compile-time constants. In Dart, The numeric value 1 or 0 cannot be used to specify the true or false. The bool keyword is used to represent the Boolean value. The syntax of declaring the Boolean… Continue reading Dart Boolean
Dart Interfaces
An interface defines the syntax that any entity must adhere to. Dart does not have any separate syntax to define interfaces. An Interface defines the same as the class where any set of methods can be accessed by an object. The Class declaration can interface itself. The keyword implement is needed to be writing, followed… Continue reading Dart Interfaces
Using super keyword with constructor
We can use the super keyword to access the parent class constructor. The super keyword can call both parameterized and non-parameterized constructors depending on the situation. The syntax is given below. Syntax: :super(); Example – // Base class called Parent class Parent { Parent() { print(“This is the super class constructor”); } } // Child class Super class Child extends Parent { Child():super() // Calling super class constructor { print(“This is the sub class constructor”); } } void main() { // Creating object of sub class … Continue reading Using super keyword with constructor
Dart – Super keyword
In Dart, super keyword is used to refer immediate parent class object. It is used to call properties and methods of the superclass. It does not call the method, whereas when we create an instance of subclass than that of the parent class is created implicitly so super keyword calls that instance. Advantages of super keyword: It… Continue reading Dart – Super keyword
Dart – Loop Control Statements (Break and Continue)
Dart supports two types of loop control statements: Break Statement Continue Statement Break Statement: This statement is used to break the flow of control of the loop i.e if it is used within a loop then it will terminate the loop whenever encountered. It will bring the flow of control out of the nearest loop.… Continue reading Dart – Loop Control Statements (Break and Continue)
How to Replace a Substring of a String in Dart?
To replace all the substring of a string we make use of replaceAll method in Dart. This method replaces all the substring in the given string to the desired substring. Returns a new string in which the non-overlapping substrings matching from (the ones iterated by from.allMatches(this String)) are replaced by the literal string replace. Syntax:… Continue reading How to Replace a Substring of a String in Dart?