问题
in my flutter app the user picks a time and I need to simply add some hours and minute to it to display the result. Is that easily possible? Unfortunately, there doesn't seem to be a function like TimeOfDay.add().
Any ideas?
Thanks!
回答1:
You can Use Date Time for that: You can add Minutes or Hours as you like.
TimeOfDay.fromDateTime(DateTime.now().add(Duration(hours: 2))); // result is 2hrs ahead of current time
来源:https://stackoverflow.com/questions/53015124/flutter-timeofday-calculations