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
Tag: dart
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
Dart Classes and Object
Dart classes are the blueprint of the object, or it can be called object constructors. A class can contain fields, functions, constructors, etc. It is a wrapper that binds/encapsulates the data and functions together; that can be accessed by creating an object. A class can refer to as user-define data type which defines characteristics by… Continue reading Dart Classes and Object
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 Function
Dart function is a set of codes that together perform a specific task. It is used to break the large code into smaller modules and reuse it when needed. Functions make the program more readable and easy to debug. It improves the modular approach and enhances the code reusability. Suppose, we write a simple calculator… Continue reading Dart Function
Dart Switch Case Statement
Dart Switch case statement is used to avoid the long chain of the if-else statement. It is the simplified form of nested if-else statement. The value of the variable compares with the multiple cases, and if a match is found, then it executes a block of statement associated with that particular case. The assigned value… Continue reading Dart Switch Case Statement
Core libraries: Dart
Dart has a rich set of core libraries that provide essentials for many everyday programming tasks such as working on collections of objects (dart:collection) , making calculations (dart:math), and encoding/decoding data (dart:convert). Multi-platform libraries. The following table lists the Dart core libraries that work on all Dart Platform. dart:coreBuilt-in types, collections, and other core functionality… Continue reading Core libraries: Dart
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?