'Unit Test Flutter Exception

I have flutter code like this:

PresentationModel _presentation = PresentationModel();

void otpOnChange(String otp) {
     try {
       _presentation = presentation.copyWith(otp: otp);
     } catch(e) {
       _logger.log('Error in otpOnChange );
     }
   }

how do i make a unit test for the exception ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source