Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can i increase only 1 microsecond to Dateime.now() in dart

i have the following

Dateime.now() + here i need to increase only 1 microsecond

so wanted output is Dateime.now() + that incensement which is 1 microsecond

i tried the following but it does not work

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

print(DateTime.now()+const Duration(microsecond : 1);)

How can i implement this

>Solution :

This well get it done.

final now = DateTime.now();
final later = now.add(const Duration(millisecond: 1));

check docs here

Or do it in a single line:

DateTime now = DateTime.now().add(Duration(milliseconds: 1));
print(now);
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading