How to get compile/build date on Flutter App?

You can use a build shell script that creates/updates a Dart file in lib/... with constants holding the date before running flutter build ....
You then import that file in your code and use it.


I'll suggest that you also consider basically rolling your own version of the package_info library which includes all the information you want to get from the platform code. I use the Gradle build files to update some variables on each build, which I then retrieve from Flutter.

Examining the package_info code shows that it is really a fairly simple MethodChannel use case. You could add anything that you can get from the native side.

Tags:

Flutter