How to set default value in function

Posted by Andre Scott | Updated on | Flutter

Want to set default value in function? The syntax you use is correct, but as the error message says, the value has to be a compile time constant. A compile time constant doesn’t make sense for DateTime.now().

As a workaround, you can use:


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.

Related Questions & Answers