TestingDocs.com
    Software Testing website
    • Automation
      • Selenium
      • JBehave Framework
    • Tutorials
      • MySQL Tutorials
      • Testlink
      • Maven
      • Git
    • IDEs
      • IntelliJ IDEA
      • Eclipse
    • Flowcharts
      • Flowgorithm
      • Raptor
    • About

    Dart

    Basic Dart Program Example

    Overview

    In this tutorial, we will learn to create a basic Dart program using IntelliJ IDEA. Dart is an object-oriented programming language that was developed by Google, Inc. It was created as a language for building web and mobile applications.

    Dart supports different types of development, like command-line applications, client, and server-side application development. To execute and run the Dart programs, you can use dart.exe on Windows or an IDE tool like IntelliJ IDEA, or Eclipse.

    Dart Program Example

    Let’s create a sample Dart program to print the Hello, World! message on the standard output.

    Launch IntelliJ IDEA.

    Create a Dart project.

    Steps to create a Dart project using IntelliJ IDEA:

    https://www.testingdocs.com/new-dart-project-using-intellij-ide/

    Add a new Dart source file to the project.

     

    Create New Dart File

    Specify the filename. The Dart file would have a .dart file extension.

    For example, hello.dart file.

    Code Listing

    Add the following Dart source code to the file.

    /* * Hello World Dart Program

    * Dart Tutorials – www.TestingDocs.com

    */

    main(){

    print(“Hello, World!”);

    }

     

    Hello World Dart Program

     

    The main() function as an entry point to the Dart application. The print() function is predefined and prints the specified string or value to the standard output device like the console window on the computer screen.

    Run Dart Program

    To execute or run the program, click on the green play button next to the filename or right-click and choose the Run option.

    Run ‘filename.dart’

    Run Dart Program IntelliJ

    Program Output

    C:/tools/dart-sdk/bin/dart.exe –enable-asserts C:\Users\testingdocs\SampleDartProject\hello.dart
    Hello, World!

    Dart Program Output

     

    That’s it. You have successfully executed a sample Dart program.

     

    —

    Dart Tutorials

    Dart tutorial on this website can be found at:

    https://www.testingdocs.com/dart-tutorials-for-beginners/

    More information on Dart:

    https://dart.dev/

    Related Posts

    Dart Compilation Techniques

    Dart /

    Dart Compilation Techniques

    Dart String Interpolation

    Dart /

    Dart String Interpolation

    Dart Lists

    Dart /

    Dart Lists

    Dart /

    Dart String Methods

    Dart Print Expression

    Dart /

    Dart print() function

    ‹ Install Dart IntelliJ Plugin› Dart Operators

    Recent Posts

    • Running Tests in Parallel with Selenium Grid
    • Advanced Selenium Features
    • Locating Web Elements
    • Running the Test Script
    • Writing Your First Selenium Test Script
    • Getting Started with Selenium Automation Testing
    • Setting Up the Environment
    • How can you monitor the Quality Assurance Audit?
    • Leveraging LambdaTest with Appium 2.0
    • Appium 2.0 Plugins ListAppium 2.0 Plugins
    • Touch Actions and Multi-Touch Actions
    • Changes in Drivers and Classes
    • Appium Inspector
    • Capabilities in Appium 2.0
    • Appium 2.0 Driver ListAppium 2.0 Driver Installation & Management
    CyberLink Multimedia Software

    Back to Top

    Links

    • Contact
    • Privacy Policy
    • Cookie Policy

    www.TestingDocs.com