avoid-unnecessary-type-casts
added in: 1.0.0 warning
Warns about of unnecessary use of casting operators.
Example
class Example {
final myList = <int>[1, 2, 3];
void main() {
final result = myList as List<int>; // LINT
}
}
class Animal {}
class HomeAnimal extends Animal {}
void patterns() {
final animal = Animal();
if (animal case Animal() as HomeAnimal) {}
if (animal case Animal() as Animal) {} // LINT
}