Skip to content

Files

Latest commit

 

History

History
25 lines (18 loc) · 421 Bytes

prefer_is_not_operator.md

File metadata and controls

25 lines (18 loc) · 421 Bytes

Pattern: Missing use of is!

Issue: -

Description

When checking if an object is not of a specified type, it is preferable to use the is! operator.

Example of incorrect code:

if (!(foo is Foo)) {
 ...
}

Example of correct code:

if (foo is! Foo) {
 ...
}

Further Reading