TheDocumentation Index
Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
Use this file to discover all available pages before exploring further.
is operator is a runtime type test operator that evaluates whether an object is an instance of a specified type or its subtype. It returns a boolean true if the object’s runtime type matches the specified type hierarchy, and false otherwise.
Dart also provides the is! operator, which is the exact logical negation of is, returning true if the object is not an instance of the specified type.
Syntax
Core Mechanics
1. Subtype Resolution Theis operator respects Dart’s object-oriented inheritance and interface implementations. If a class Child extends or implements Parent, evaluating a Child instance against the Parent type yields true.
is operator is used in a conditional statement (like if or switch), the Dart analyzer performs control flow analysis. If the test evaluates to true, the compiler automatically promotes the variable from its declared type to the tested type within the scope of that execution branch. This promotion only applies to local variables and parameters, not to instance variables or getters, as their values could change asynchronously.
is operator strictly evaluates against Dart’s sound null safety system. Testing a null value against a non-nullable type evaluates to false. Testing a null value against a nullable type (denoted by ?) evaluates to true.
is operator can evaluate the specific type arguments of generic collections at runtime, unlike languages that use type erasure.
Master Dart with Deep Grasping Methodology!Learn More





