testCode property
Optional test code that can be displayed in the editor and used to reference and test the behavior of code.
This will run as if it were in the same file as code so you can
reference any content in code from here. To run the tests, include a
main()
function here that calls them and do not include a main function
in code.
Code here will have access to a hidden method:
void _result(bool didPass, [List<String> failureMessages])
Call result with true to indicate that the test passed. Call it with false
and optional failure messages to indicate that the test failed and why it
failed.
To view tests, users have to tap on the triple dot button in the editor and toggle their visibility.
Implementation
final String? testCode;