Want to compare two TimeOfDay times in flutter/Dart? Thanks from @Lucas idea, you can calculate hour and minute by using the below code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | TimeOfDay yourTime ; TimOfDay nowTime = TimeOfDay.now() double _doubleyourTime = yourTime.hour.toDouble() + (yourTime.minute.toDouble() / 60); double _doubleNowTime = nowTime.hour.toDouble() + (nowTime.minute.toDouble() / 60); double _timeDiff = _doubleOpenTime - _doubleNowTime; double _hr = _timeDiff.truncate(); double _minute = (_timeDiff - _timeDiff.truncate()) * 60; print('Here your Happy $_hr Hour and _minute min'); |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.