How do I catch exceptions when using `flutter drive`?

119 Views Asked by At

When using flutter drive my tests still pass even when there was a runtime exception in the stack.

For example, adding this code to build(), goes undetected:

int? i;
i!.round();

Does anyone know how I can fail on this error?

1

There are 1 best solutions below

1
On
try{}
catch(e){print('error: $e')}

and if you know the exception then add this way:-

try
on
catch