How to find if we are running unit test in Dart (Flutter)
2,529
You can use the following to check if you're running a test.
Platform.environment.containsKey('FLUTTER_TEST')
Author by
AVEbrahimi
Untying an impossibly tangled knot is actually possible. For every problem, there is a solution. And I am just one who is interested in untying and solving, that's it :)
Updated on December 15, 2022Comments
-
AVEbrahimi over 1 year
While calling a function from unit test in Flutter (Dart), how can I find if I am running unit test or real application? I want to pass different data if it's in unit test.