Skip to content

Instantly share code, notes, and snippets.

@riscait
Created June 20, 2022 03:13
Show Gist options
  • Save riscait/c3941ed64eec7957e1972bd27ebe158a to your computer and use it in GitHub Desktop.
Save riscait/c3941ed64eec7957e1972bd27ebe158a to your computer and use it in GitHub Desktop.
Type check with Extended class
class BaseClass {}
class ExtendedClass extends BaseClass {}
class OtherClass {}
void main() {
final baseClass = BaseClass();
final extendedClass = ExtendedClass();
print(extendedClass is BaseClass); // true
final otherClass = OtherClass();
print(otherClass is BaseClass); // false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment