Modify rule S7054: fix typo in the Dart description
This commit is contained in:
parent
48df9b93a9
commit
7c46fffb13
@ -1,10 +1,10 @@
|
||||
== Why is this an issue?
|
||||
|
||||
Dart has an `is` operator to check the type of a variable. This operator can also be used with negation `is!`. In this case we check that the type of a variable on the left side of the operator is not the one mentioned io the right side.
|
||||
Dart has an `is` operator to check the type of a variable. This operator can also be used with negation `is!`. In this case we check that the type of a variable on the left side of the operator is not the one mentioned on the right side.
|
||||
|
||||
Similar operators also exist in other languages, but they might have different spelling. For example, in Kotlin, the same operator is written this way: `!is`. Developers familiar with both languages might confuse these 2 operators. Unfortunately, this won't lead to a compile time error, but will change the semantic of your code.
|
||||
|
||||
In Dart, `x is! Y`, will return `true` is `x` is not of type `Y` and will return `false`, if `x` is of type `Y`.
|
||||
In Dart, `x is! Y`, will return `true` if `x` is not of type `Y` and will return `false`, if `x` is of type `Y`.
|
||||
On the other hand `x !is Y` will apply null assertion operator (`!`) to `x` and then return `true` if `x` is of type `Y`, and return `false` if it is not.
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user