Dart Tutorial

Dart Tutorial Single-Page Application Architecture Dart Features Dart Installation Guide Dart Basic Program Dart Syntax Dart Keywords Dart Variables Dart Comments Dart Standard Input Output Dart Important Concepts

Data Types

Built-in Data Types Numbers Strings Booleans Lists Sets Maps Runes and Graphemes Symbols Enumerations Constants Queues

Other data types

Objects Future and stream Iterable Miscellaneous types

OPERATORS

Precedence and associativity Arithmetic operators Equality and Relational operators Type Test Operators Assignment Operators Logical Operators Bitwise and Shift Operators Miscellaneous operators

Control Flow Statements

Introduction If statement If-else statement If-else-if statement Loops Switch and case Dart Break And Continue Assert In Dart

FUNCTIONS

Dart function Types of Functions Anonymous function main( ) function Lexical scope and closure Recursion Common Collection Methods

Object Oriented Concepts

Dart Object-Oriented Concepts Dart Classes Dart Constructors Dart This Keyword Dart Super Keyword Static Members Method Overriding Dart Interfaces Inheritance Dart Abstract Classes Dart Builder Classes Dart Callable Classes

Dart Type System

Dart Type System Dart Soundness Dart Type Inference

MISCELLANEOUS

Dart Isolates Dart Typedef Dart Metadata Dart Packages Dart Generics Dart Generators Dart Concurrency Dart Unit Testing Dart Html Dom Dart URIs Dart Extends, With and Implements Keywords Dart Optional Parameters Rust Vs Dart C++ vs Dart Golang Vs Dart Dart Basics Exception Handling

Dart Type Test Operators

Type Test Operators in Dart

These operators are used to check the types of expressions at runtime. Dart is a typed language, and we often want to assert that a value is of a correct type or change the type of a value to a related type.

Consider the following table that contains the list of all the type test operators in Dart :

Sr.OperatorDescription
1.asIt is used for typecast.
2.isIt returns TRUE if the object has specified type.
3.is!It returns TRUE if the object has not specified type.

Program

Consider the following code in Dart that explains the type test operators in Dart,

void main( )
{
 String a = ' JavaTpoint ' ;


  // is type operator
  var b = a is String ;
  print( ' Is JavaTpoint a string ? ' ) ;
  print( b ) ;
  
  // is! type operator
  var c = a is! String ;
  print( ' Is JavaTpoint not a string ? ' ) ;
  print( c ) ;
}

Output

 Is JavaTpoint a string ? 
 True


 Is JavaTpoint not a string ? 
 False