close

How to Display Current DateTime in Flutter

Hello Guys How are you all? Hope you all are fine. Today We are going to learn How to Display Current DateTime in Flutter?

Many Times We have to display Current Date time with date, month, year, hours, minutes and second, with real time clock in flutter. in very easy way we are going to learn in this tutorial a=here. so without wasting your time lets start this tutorial.

How to Display Current DateTime in Flutter

How to Display Current DateTime in Flutter?

Question: How to Display Current DateTime in Flutter ?
Answer: how to display current datetime in flutter. Many Times We have to display Current Date time with date, month, year, hours, minutes and second in our app…

  • First of All Import material.dart, async, and intl Package in your main.dart file.
  • Then, Create void main and Define MyApp in your runApp.
  • Now, Create a class named MyApp extends with a Stateless widget. This is our main View class. and define
  • Then, After making Scaffold in MyApp Widget. The scaffold is the Base of every flutter apps, Scaffold provides app bar, background color, drawer, body, bottom sheet, etc.
  • We need a center widget in our body so add the Center widget in the body.
  • Now Define DateTime String name that you want to display.
  • after that, make method named _getTime and use DateTime.now().
  • and set _timeString in setState as like below.
  • Add _getTime method in initState Same like below.
  • Here Timer.periodic has Duration property that will trigger _getTime method every second. So You will get Every second time in your display.
  • Here Is my main.dart full sourceCode for batter understanding.

So Guys That’s It For How to make a blur effect in Flutter using BackdropFilter. Hope you like our tutorial. Comment below Your thoughts and your queries. And Also Comment below your suggestion here.

Also Read How to make a blur Background Image effect in Flutter using BackdropFilter.

Milan Dhameliya is an Information Technology Engineer. By profession, he is a Full Stack developer with knowledge of multiple back-end platforms (e.g., PHP, Node.js, Python) and frontend Flutter frameworks.

Leave a Comment