<p>Hello Everyone,Today we are talking about how to convert a list of date and time into string.First of all, you know about list.map concept before learning of these things.
post-textitemprop="text](
The code block inside list.map is never executed.</p>
<p>This is because list.map produces a lazy transformation of the list.
The transformation function is executed only when elements are requested
from it.</p>
<p>You probably want to use:</p>
<p><pre class="lang-dart prettyprint prettyprinted](kwd](varpln]( dates pun](=pln]( listpun](.pln](mappun](((typ](DateTimepln]( timepun]()pln]( pun]({pln]( kwd](varpln]( dateRange pun](=pln]( typ](DateFormatpun]((str]("MM-dd-yy"pun]().pln](formatpun]((pln](timepun]();pln]( kwd](returnpln]( dateRangepun](;pln]( pun](});pln]( printpun]((pln](datespun]();```</p> <p>In the code above, it is the print function that forces the transformation to run.</p> <p>Alternatively, you can transform the result of the list.map to a list using</p> <p><pre class="lang-dart prettyprint prettyprinted](
kwd](varpln]( datesList pun](=pln]( datespun](.pln](toListpun](();```</p>
<p>Again, this forces eager evaluation of the map transformation.</p>
<p>![](../../Uploads/91847301-c22c-436f-8d0a-e74c90755cbb.pngwidth="50%height="auto](</p>
How to Converting a List of DateTime into Strings ?
This Article is posted by nikhilchaudhary12155 at 10/29/2019 4:05:34 AM
Check out our other latest articles
Safearea widget - How to avoid visual overlap with Notch on flutter mobile app?How to convert row of widgets into column of widgets in flutter based on screen size?
How to run Flutter programs from GitHub?
How to get screen orientation in flutter?
NavigationRail example in flutter
Tags: flutter flutterisfuture
Check out our other latest articles
Safearea widget - How to avoid visual overlap with Notch on flutter mobile app?How to convert row of widgets into column of widgets in flutter based on screen size?
How to run Flutter programs from GitHub?
How to get screen orientation in flutter?
NavigationRail example in flutter