As we all know Dart is a typed programming language. A typed programming language is the programming language which is based on Data Types. Everything in dart is based on Type. Dart dose support type casting also. But sometimes developer wants to know if the given object or Variable is specific data type or not. Using the Type test operators we can easily check type of given object or Variable. So in this tutorial we would learn about Type Test Operator in Dart Flutter With Example in Android iOS.
Contents in this project Type Test Operator in Dart Flutter With Example:
1. is Type Test Operator :- Returns True if the given object or Variable has same Data type.
1 2 3 4 5 6 7 |
void main() { int a = 10; print(a is int); } // Output is True. |
2. is! Type Test Operator :- Returns True if the given object or Variable has NOT same type.
1 2 3 4 5 6 7 |
void main() { double a = 10.22; print(a is! int); } // Output is True. |
Also Read:
Flutter Create Call Function From Same Class on Button Click Example
Flutter Add Assets Images Folder Path in Pubspec.yaml File iOS Android
Example of Write $ Dollar Sign in Text in Flutter
List of All Data Types Available in Dart Flutter Explained with Example
Flutter Dart Create Function With Default Optional Arguments Example Tutorial