Does Dart support == and === ? What is the difference between equality and identity?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Dart supports
==for equality andidentical(a, b)for identity. Dart no longer supports the===syntax.Use
==for equality when you want to check if two objects are "equal". You can implement the==method in your class to define what equality means. For example:Note that the semantics of
a == bare:aorbarenull, returnidentical(a, b)a.==(b)Use
identical(a, b)to check if two variables reference the same instance. The identical function is a top-level function found indart:core.