Skip to main content ppwriters

#30DaysMasterFlutter

Day 2

First Dart app

Create and run your first Dart console application. This will allow you to get familiar with the Dart syntax and how to write a simple console application using it.

Project - Greet User

Create a Dart console application that asks the user for their name and prints a greeting message to the console.

Hello <name>!

By the end of this day, you should have a basic understanding of the Dart syntax and how to write a simple console application using it.

Tips

  • To create new dart console application, you can use the dart create command. The default is always a console application.
dart create greet_user
  • To Get user input in Dart, you can use the stdin.readLineSync() function. For example:
import 'dart:io';

void main() {
  print("Enter anything:");
  String? input  = stdin.readLineSync();
  print("You entered: ${input}");
}

Resources

Enjoying? Tell your friends.

#30DaysMasterFlutter

Learn the basics of Flutter and Dart in 30 days! We provide a roadmap, resources, and project ideas to help you along your journey.

back to 30 Days to Master Flutter

Join our community on Discord to connect with fellow learners, share your progress, and get help with any questions you may have throughout the #30DaysMasterFlutter challenge. Join now and get started on your journey to mastering Dart and Flutter!

join now