Dart is an object-oriented, open-source, client-optimized development programming language. It has C-styled syntax. It is used to create a good-looking front-end
Like C/C++, Dart also needs to declare DatatTypes of the variable during declaration. In Dart, we have the following:
int
bool
double
string
num
Map
List
There are also some keywords that can also create variables. These are var
, dynamic
, final
, and const
.
Dart is very easy to learn. It is a new programming language created in 2017 by Google. Google developers put their efforts into developing this language for their cross-platform framework. Following are the main features of the Dart language that made it becomes so popular.
Dart offers null safety. This means that variables cannot be null unless explicitly mentioned. With this feature, Dart protects developers from facing null exceptions during the execution of the source code.
Dart has an extensive and excessive set of core libraries that helps developers with their everyday programming tasks. Following are some examples of Dart built-in libraries.
dart:core
: This provides the core functionality of the program.dart:html
: This provides HTML and Document object model for web-based applicatios (DOM). dart:math
: This provides a mathematical functions library.dart:collection
: This provides data structures like queues, linked lists, maps, and trees. dart:io
: This provide files, sockets, and other Input output for client-server-based programs. Both Flutter and Dart have good documentation. With the help of a dartpad, we can become familiar with syntax so easily.
Note: To check the official documentation of Dart, click here
Dart is a programming language used in Flutter. The Flutter community supports programmers by answering queries, helping debug code, and organizing events. The community is still growing today.
The following Dart program will take a number from the user and print a pattern of that height on the console.
import 'dart:io';void main(){// Taking input from user and typecast it to intint rows = int.parse(stdin.readLineSync());for(int i = 0 ; i< rows; i++){for(int j = 0; j<=i;j++){//Printing * on the consolestdout.write('* ');}// Print new line on the consolestdout.writeln();}}
Enter the input below
Free Resources