Equality in Dart | Decoding Flutter

preview_player
Показать описание
Learn about different possible definitions for "equality", how Dart operates by default, and how you can alter that behavior to simplify your Dart and Flutter apps.


#DecodingFlutter #Flutter #Developer
Рекомендации по теме
Комментарии
Автор

Equatable is a must use package for all flutter projects, it saves lot of time ❤️

bdmaxvalera
Автор

Very clean explanation by Flutter Team. I love it. Thank you.

prasantkumar
Автор

This video contains wrong information: You should NOT use hash code in the equality operator. Two objects that are equal should have the same hash code, but two objects that are not equal can also share the same hash code. Mathematically, this is due to the pigeon hole principle. The Equatable package also does not use hash code in the equality function.

Hash codes exist to speed up hash maps and other data structures. Finding an object in a map is much easier if you can boil it down to a simple integer value.

julien-scholz
Автор

Not sure I'm gonna use it, but it's amazing to know we can override an operator 😂

acavals
Автор

Also please decode bool vs Future<bool>, and what is the use use of Future<bool> when it can't be used to check condition

VinayBaise
Автор

What about hash collisions? If 2 objects have same hash code doesn't mean that they are the same

Bozacar
Автор

I still prefer using "Command + n" -> "generate ==() and hashCode", it's way faster

clever_dude
Автор

very clean
can you show me how to use regex to validate email and password in dart?
thank you

jeffdon
Автор

equatable is nice package, though it'd be great if there's data class on dart

akaneritsuki
Автор

What about deep nested Maps and Lists? Would equatable understand 2 deep nested maps are same? Does it do some recursion under the hood in order to override its hashmap?

aytunch
Автор

really really cool explanation !! keep it up.

m
Автор

This is so cool. But another issue u run into is if you want your class to extend another class. In Dart, a class can't extend more than one classes so it's impossible to extend Equattable and another class.
A solution for this (if u use VSCode) is to install the Dart class generator extension. This would generate the equality code for u

codegambit
Автор

thank you very much
i have one important question
how did you animate the code like this :)
is there a specific method or tool to do that?

abdullahaqrabawy
Автор

What if i don't have final members in a class and i want to modify the objects' properties, what should i do?

haseebkahn
Автор

❄️ Freezed package handles everything under the hood

ThEGeEeK
Автор

I love the Decoding Flutter series! 💜
On unrelated question though: What tool do you use to create these cute text animations? I mean the ones you use to show the code block changes in these videos.

mbsd
Автор

why to check if other is of type A just modify your == operator with covariant

manishmg
Автор

Thanks, I see the link between const constructor in Flutter and that Flutter doesn't rebuild those const widget: the default equality must be used.
Though would it be possible to override equality for a subclass of widget to avoid rebuild even with non const constructor?

fredgotpub
Автор

For once, the software is actually really useful

pablojaviergarcia
Автор

Can someone comment down some good recourses ( including book, courses etc )to learn dart and flutter and how to develop a great app overall
i have no prior experience in app development.
i know about little bit about c and c++

sahil