Inspectopedia
 
2024.3

'assert' call can be replaced with '!!' or '?:'

Info
New
Last modified: 03 December 2024

Reports assert calls that check a not null value of the declared variable.

Using !! or ?: makes your code simpler.

The quick-fix replaces assert with !! or ?: operator in the variable initializer.

Example:

After the quick-fix is applied: