Protection Status

Getting Started with Dart Programming Part 2 || Flutter App Development Tutorial

Comments in Dart Programming - Comments are the non executable lines of code in any programming language. All programming languages including Dart supports various types of comments. Different Types of Comments supported by Dart Language are as follows

  1. Format Comments

  2. Block Comments

  3. Doc Comments

Format Comments - Single Line Comments. Example //this is format comment

Block Comments - Multi Line Comments. Example /*This is a multi line comment */

Doc Comments - Document Comment used for member & types. Example ////

Continue & Break Statement in Dart Programming -

Dart has also used the continue and break keyword in the loop, and elsewhere it required. The continue statement allows you to skip the remaining code inside the loop and immediately jump to the next iteration of the loop. We can understand it from the following example.

void main() {   
 for(int i=1;i<=7;i++){    
      print("Fresher Side");  
 continue; //it will skip the rest statement       

The break statement allows you to terminate or stops the current flow of a program and continues execution after the body of the loop. The following example gives a detailed explanation.

void main() {   
 for(int i=1;i<=7;i++){    
      print("Fresher Side");  
 break;//it will terminate the rest statement       

Final & Constant Keyword -

We can use a final keyword to restrict the user. It can be applied in many contexts, such as variables, classes, and methods.

Const keyword is used to declare constant. We cannot change the value of the const keyword after assigning it.

void main() {   
 final a = 99;  
 const pi = 3.14;  

Object Oriented Programming in Dart -

As we already know dart is a programming language, which means every value of dart is an object. Everything from a Number to String is an object in our Dart Language. Dart Programming supports all the OOP's features like Classes, Objects, Interfaces etc.

Object: An object is an entity, which has state and behavior. It can be physical or logical. In Dart, every value is an object, even primitive values like text and number. Dart can also allow you to build your custom object to express more complex relations between data.

Class: A class is a collection of objects. It means the objects are created with the help of classes because every object needs a blueprint based on which you can create an individual object. A class definition includes the following things:

  • Fields

  • Methods

  • Constructor

  • Getters and setters

Let us see an example, which helps you to understand the OOPs concept easily.

class Mobile {  
 // Property Declaration 
  String color, brandName, modelName;  
 // Method Creation 
  String calling() {  
 return "Mobile can do call to everyone.";  
  String musicPlay() {  
 return "Mobile can play all types of Music.";  
  String clickPicture() {  
 return "Mobile can take pictures.";  
void main() {  
 // Object Creation 
  var myMob = new Mobile();   
 // Accessing Class's Property 
  myMob.color = "Black";   
  myMob.brandName = "Apple Inc.";  
  myMob.modelName = "iPhone 11 Pro";  
 //Display Output 

Pervious Topic - Getting Started with Dart Program - Part 1

Next Topic - Flutter Widgets

6 views0 comments

Related Posts

See All

Tut 5 Column || Flutter App Development

If you already read about Row widget from our previous blog then it will be very easy for you to understand about Column widgets because properties are almost same with Row widget. Column:- Column is

  • Facebook
  • Instagram
  • LinkedIn
  • 1024px-Telegram_logo.svg
  • download
  • YouTube
  • Google Play