Тёмный

Freezed (Package of the Week) 

Flutter
Подписаться 570 тыс.
Просмотров 180 тыс.
50% 1

Learn more about product → goo.gle/3oAtlne
Tired of writing tedious boilerplate for simple data classes? Try Freezed, a code generation package in Dart that can accelerate your development.
This video is also subtitled in Chinese, Indonesian, Italian, Japanese, Korean, Portuguese, and Spanish.
Learn everything about Flutter at → goo.gle/2WAhEN1
Get more tips! → goo.gle/FlutterPackage
Subscribe to Flutter! → goo.gle/FlutterYT
#PackageoftheWeek #Widgets #Flutter
product: Flutter - Development - User interface; fullname: Craig Labenz;

Наука

Опубликовано:

 

8 дек 2021

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 184   
@Sominemo
@Sominemo 2 года назад
Nice, but would be good for Dart to actually implement data classes
@SAPierce2006
@SAPierce2006 2 года назад
Code generation in dart is janky and terrible. It's not the same as language features.
@ebelevics
@ebelevics 2 года назад
yeah, even the fact that they announced Freezed as Package of the Week it is not even funny. There shouldn't be such package for "modern language" as Dart at the first place
@kirill4531
@kirill4531 2 года назад
Sometimes code generation takes too much time
@CagatayOncul
@CagatayOncul 2 года назад
Code gen is fully headache
@FlutterInsights
@FlutterInsights 2 года назад
I have worked on some projects using freezed as suggested by my team colleague and i found it really pain while dealing with states between immutable freezed classes and what i like about freezed is it's saves us from running into bugs by showing errors in line editing thats all rest is so tiring and complex work and a lot of generated codes with multiole files and 80% of those generated codes are not even used most of the time ahh its really terrible experience fr me and its not flexible you have to use .copyWith or create new var and assign the freezed values to the new then only you can modify the values really pain .
@SunFoxx_
@SunFoxx_ 2 года назад
You know the code generation packages are a huge crutch of a solution. And a clear sign of the language/framework missing something vital within itself. I hope your team will be able to get rid of the necessity to use such kinds of hacks that overcomplicate our codebases with 3rd party syntax
@giorgospapadakis7613
@giorgospapadakis7613 2 года назад
the answer is reflection but flutter will never support that
@fuadall8961
@fuadall8961 2 года назад
Totally agreed. Sad to see that instead offering stable solutions Google team offers such ugly unprofessional hacks
@julius4858
@julius4858 Год назад
@@giorgospapadakis7613 may I ask why it will never happen?
@MegaLittlePaw
@MegaLittlePaw Год назад
Couldn't say more accurate, man. Long story of using codegen in Java tough me that it's not the thing you want to have around in any environment.
@maskedvillainai
@maskedvillainai Год назад
@@giorgospapadakis7613 what’s reflection? Noob here. I could just Google on it. Then reflect on it. Nah I think I know what it is but curious the benefits on this
@BooleanDev
@BooleanDev 2 года назад
I’ve always preferred the Dart Data Class VS Code extension Edit: the author deleted the extension... however there are multiple reuploads
2 года назад
Indeed amazing time saving tool.
@marlonsubuyu2012
@marlonsubuyu2012 2 года назад
Good to know, I'll give it a try
@sajithlaldev3354
@sajithlaldev3354 2 года назад
Way better idea
@sajithlaldev3354
@sajithlaldev3354 2 года назад
I have the tutorial video in my channel
@atmega3212
@atmega3212 2 года назад
Thanks! I don't know how I could have missed such an extension.. It even works with Equatable package.
@ezeaguprincewill7005
@ezeaguprincewill7005 2 года назад
I have not used freeze package before though....I always thought it's was way complicated than the problem it's was trying to solve.. However, thanks to this clip...I think I play round with it...
@digitalsuperman
@digitalsuperman 2 года назад
i have the same thing in mind.
@dolbysoundsofficial9323
@dolbysoundsofficial9323 2 года назад
Try its Out Its Also Provide Unions
@ezeaguprincewill7005
@ezeaguprincewill7005 2 года назад
@@dolbysoundsofficial9323 wow. Cool.
@keithbacalso9433
@keithbacalso9433 2 года назад
@@dolbysoundsofficial9323 Unions? does thst mean equality? like the Equatable package?
@Masus04
@Masus04 2 года назад
Sadly the package used to get rid of boilerplate requires quite a bit of boilerplate.. It also seems way less readable than most alternatives..
@michasengotta2295
@michasengotta2295 2 года назад
You're just listing your variables and add a few self-explanatory annotations. Not a lot of boilerplate in my book.
@vaibhavdangayachvd
@vaibhavdangayachvd 2 года назад
I personally use Freezed a lot and I can say that its nothing compared to the benefits it provides
@michasengotta2295
@michasengotta2295 2 года назад
@@vaibhavdangayachvd I also don't know what alternatives they are talking about other than not using Flutter at all 😅
@patibandasriram7613
@patibandasriram7613 2 года назад
You have no idea how many people were waiting for this!!
@officialismailshah
@officialismailshah 2 года назад
We just can't thanks this beautiful community of flutter they are making so much valuable content today flutter release was amazing....
@schinsky6833
@schinsky6833 2 года назад
For me the biggest advantage of freezed wasnt even mentioned in this video. Freezed classes work like kotlin's sealed classes that allow for exhaustive case comparison. That really can fix bugs at compile time. Less debugging weird bugs, more happy coding.
@kirill4531
@kirill4531 2 года назад
Please go to the next door where Kotlin devs sit and ask them how to add Data classes. Thank you ❤️
@abhimanyu.n14
@abhimanyu.n14 2 года назад
Kotlin data class is so simple. Coming from Android, this seems too much to learn for a simple data class.
@walrider7374
@walrider7374 Год назад
@@abhimanyu.n14 Dart feels like I was pushed back to Java . I miss Kotlin so much
@rcjuancarlosuwu
@rcjuancarlosuwu 2 года назад
Remi, we all love you :')
@user-pk6wi5ed4g
@user-pk6wi5ed4g 2 года назад
I don't know why, but it's a little surprising that flutter introduces freezed.
@daviidon
@daviidon 2 года назад
We need discriminated unions and pattern matching in dart. These alone would remove the need for some much boilerplate and code generators.
@venir_dev
@venir_dev 2 года назад
Cool to see that Remi's work is being appreciated even by the Flutter team... way to go!!
@dolbysoundsofficial9323
@dolbysoundsofficial9323 2 года назад
Remi's Work is Great ✌️
@aadarsh8869
@aadarsh8869 2 года назад
Remi is a living legend. He inspires me.
@Yayaloy9
@Yayaloy9 8 месяцев назад
The damn problem is that he doesn't get a penny from any of thise
@wdestroier
@wdestroier 2 года назад
I prefer a vscode extension that generates everything instantly and without the need of any dependency
@michasengotta2295
@michasengotta2295 2 года назад
Does that exist?
@myxzlabs5635
@myxzlabs5635 2 года назад
me too pal
@albcastle709
@albcastle709 2 года назад
@@michasengotta2295 Data class Extension
@imamhatipoglu4040
@imamhatipoglu4040 2 года назад
That's the best solution. You don't wait build runner everytime. İt's time saver
@michasengotta2295
@michasengotta2295 2 года назад
What it your class changes?
@joeyreddick6036
@joeyreddick6036 2 года назад
Thank you flutter you guys really make the job simpler
@ilyosbekibrokhimov5266
@ilyosbekibrokhimov5266 2 года назад
I think Dart data class extension in Vs Code can be excellent alternative for freezed
@sampathnarayanan3229
@sampathnarayanan3229 2 года назад
Or I can simply install an extension like dart data class to generate these. Much easier than freeze i guess.
@kirill4531
@kirill4531 2 года назад
Could you please share the link?
@sampathnarayanan3229
@sampathnarayanan3229 2 года назад
@@kirill4531 similar extension is available for VS Code too if that's your preferred IDE
@kirill4531
@kirill4531 2 года назад
@@sampathnarayanan3229 do you happen to know if something similar is available for Android Studio?
@user-pt5he1yq9n
@user-pt5he1yq9n 2 года назад
@@kirill4531 Dart Data Class
@bdmaxvalera
@bdmaxvalera 2 года назад
Awesome. But still a boilerplate left on this solution. Data classes is far away a better solution for dart language
@cardboard3161
@cardboard3161 2 года назад
Awesome, I was just thinking about this!! :D
@randomlee101
@randomlee101 2 года назад
I was just thinking of this today
@johnnynguyen6909
@johnnynguyen6909 2 года назад
Hrmm looks like a lot of people here are pointing out that this is a more complicated of the data class extension, however don't take into account that freezed allows for sealed classes and unions which are essentially a language feature that dart is lacking
@leandroamarillo3262
@leandroamarillo3262 2 года назад
Still a fair criticism, it's ok just wanting data classes
@CodingYourLife
@CodingYourLife 2 года назад
thanks.. Love it so much.
@mikkelthygesen3856
@mikkelthygesen3856 2 года назад
"If you've come to Flutter in Dart by the way of other languages, you may have noticed that dart asks you to write a fair amount of boilerplate for simple classes" You actually admits this and don't think its a problem?
@its_me_mahmud
@its_me_mahmud 2 года назад
Thanks for this amazing package Remi Rousselet 💙
@devbathani8020
@devbathani8020 2 года назад
Great package saves a lot of time 🔥👍
@AhmadSattout97
@AhmadSattout97 2 года назад
It's still bad that you need to manually import the packages, and the fromJsom toJson methods instead of them working automatically. Also the fact you need to manually tell it to build, and not it doing that whenever you rerun the app
@sokr5903
@sokr5903 2 года назад
You can issue this command only once `flutter packages pub run build_runner watch` and it will watch for changes in generation files and rebuild everything upon every save.
@dolbysoundsofficial9323
@dolbysoundsofficial9323 2 года назад
This is Best Package i ever seen😘🔥
@wish8047
@wish8047 2 года назад
I think you should also talk about the limitations of using freezed, like not being able to use 'extends', because this may be a deal breaker in a lot of situations
@michasengotta2295
@michasengotta2295 2 года назад
Why can you not use 'extends' with it though?
@wish8047
@wish8047 2 года назад
@@michasengotta2295 I am not sure of why, but it clearly says in the documentation of freezed that it does not support inheritance. I also tried it anyways and it results in a lot of errors. Not sure of what caused this, since I don't know that much about the implementation details of freezed, but it is a thing.
@michasengotta2295
@michasengotta2295 2 года назад
@@wish8047 ok that sucks. Thanks for the heads up, I was about to use it, but now I'm not so sure..
@sharbelokzan9673
@sharbelokzan9673 2 года назад
Please add data classes to dart natively
@kafran
@kafran 2 года назад
Dart has so much to evolve.
@harinandanrnair6768
@harinandanrnair6768 2 года назад
Amazing to see Freezed here
@sangamshrestha143
@sangamshrestha143 2 года назад
Every package by Remi is amazing.
@PurvikRana
@PurvikRana 2 года назад
Great package to know about. It is kinda same that we use with chopper.
@krtirtho
@krtirtho 2 года назад
It's a shame for Dart that it's not dynamic enough & we've to use third-party tools to "generate" extreme boilerplate code
@__renesan
@__renesan 2 года назад
Gracias ♥
@erlangparasu7524
@erlangparasu7524 Год назад
So helpful!
@Aspiiire
@Aspiiire 2 года назад
Freezed is amazing and Flutter's RU-vid Channel is growing everyday more! 😄🔥
@TarY_
@TarY_ 2 года назад
J'utilise déjà la classe gelée. c'est une classe incroyable. ça fait gagner beaucoup de temps ❤️❤️❤️
@melomanzer5508
@melomanzer5508 2 года назад
Ça sera compliqué de l'utiliser avec hive je crois
@freshtechtips
@freshtechtips Год назад
How about the setters?? freezed required factory consturctor so we can't extends that class and add setters and extra functionallity, I think those duplicated code should really dart core feature, dart data class like kotlin
@imrahil008
@imrahil008 2 года назад
Should we version control the generated classes?
@galihriskipratama3631
@galihriskipratama3631 2 года назад
great video as always but still a little confusing for me
@muhammadanas7502
@muhammadanas7502 2 года назад
Still I will recommend to use general way... because it is more simple and less dependent...
@hboleto
@hboleto 2 года назад
Freeze!! Hammer Time!
@faizandarwesh7867
@faizandarwesh7867 2 года назад
what's the difference b/w dev_dependency and normal dependency? Anyone ?
@balajir9393
@balajir9393 2 года назад
So it is just a combination of json annotation , json serializable and equatable library?
@johnnynguyen6909
@johnnynguyen6909 2 года назад
No, it also adds sealed classes and unions, which are extremely powerful and yet to be added natively to dart
@sunilgrewal9043
@sunilgrewal9043 2 года назад
I already use freezed class. it is amazing class. it save a lot of time ❤️
@dolbysoundsofficial9323
@dolbysoundsofficial9323 2 года назад
YAHH ITS LIFE SAVING ...!!
@anandhu5082
@anandhu5082 2 года назад
what happens when we give a variable on RHS of a factory constructor?
@craiglabenz9147
@craiglabenz9147 2 года назад
This is called a "redirecting constructor", and it means that all of the relevant implementation can be found within the class that appears on the RHS. In Freezed's case, this entire class definition is part of the code Freezed will generate for us :)
@HermanPalmgren
@HermanPalmgren 2 года назад
Nice! Will be great for the app I am building rn
@AaronPritzlaff
@AaronPritzlaff 2 года назад
Sorry - yuck. I'll just continue to use my existing code templates and copy/paste.
@RightNow978
@RightNow978 2 года назад
Can we get an official package to make GIFs from video files? We need more utility!
@michaeledano8067
@michaeledano8067 2 года назад
Next package of the week: Riverpod
@kevinlopez287
@kevinlopez287 2 года назад
For those who wonder why is this required, i do the search and it's needed to keep the compiled binaries size as low as possible. Dart supports reflection but flutter doesn't.
@mikopiko
@mikopiko 11 месяцев назад
Had no idea Dart supported reflection!
@hsnham6020
@hsnham6020 2 года назад
👏
@sanketnaik2082
@sanketnaik2082 2 года назад
Please add data classes and sealed classes to dart!!
@TheHellishFrog
@TheHellishFrog 2 года назад
So much fuss just to work with data classes?
@user-pz1ce7on4x
@user-pz1ce7on4x 2 года назад
Ахаха ))) проще реализовать свои методы toMap fromMap ... Сделайте уже толковую рефлексию, чтоб вызывать методы по строке
@thefable2874
@thefable2874 2 года назад
Nice and handy, but would it be better to name that package something more explanatory, something that refers to boilerplate code or whatever!!!
@vuongnguyenthien319
@vuongnguyenthien319 2 года назад
This package solved my problems
@mqhamdam
@mqhamdam 2 года назад
Freezed 🥶
@hamzabarry7880
@hamzabarry7880 2 года назад
Why that emoji??
@mqhamdam
@mqhamdam 2 года назад
@@hamzabarry7880 cuz its freezed and I like it) nothing more. :)
@jascodes
@jascodes 2 года назад
So simple isnt it ;P
@amicloud_yt
@amicloud_yt Год назад
In inelegant solution to a messy problem...
@erlangparasu6339
@erlangparasu6339 2 года назад
auto build will be good
@mohanpreetsingh716
@mohanpreetsingh716 2 года назад
Can someone explain what problem this is solving?
@koldoon3279
@koldoon3279 2 года назад
This is a crutch for absent reflection.
@mohanpreetsingh716
@mohanpreetsingh716 2 года назад
@@koldoon3279 that confused me more than i was before lol
@habibulumam9395
@habibulumam9395 2 года назад
I thought use a plugin in android studio to generate my model is easier than this package. 😁
@findsarfaraz
@findsarfaraz Год назад
how to add late keyword to field declaration
@craiglabenz9147
@craiglabenz9147 Год назад
I don't see any mention of this in Freezed's docs. While not exactly the same, you can always use `myObj.copyWith()` to set the "late" value, or you can use @unfreezed to use mutable classes instead.
@erkinkurt6799
@erkinkurt6799 2 года назад
Emir as bayrakları
@TheMikkelet
@TheMikkelet 2 года назад
4 dependencies, several annotations, command line tools and code generation. This implementation is tedious.. should have used kotlin honestly
@jonstorchevoy6087
@jonstorchevoy6087 2 года назад
I have no fn idea why they didn't use Kotlin as the default. It was sitting there ready to go. Already used on Android. Can't think of a single bennifit of selecting Dart over Kotlin. I wonder whose pet project Dart was?
@Nyao35
@Nyao35 2 года назад
I wish Flutter uses Kotlin instead of Dart, the world would be an happier place.
@krtirtho
@krtirtho 2 года назад
Are you high? Rewriting 10 probably 20000 lines of code in a completely different language Also how much more do you want of that JVM? Its hard to debug, super slow & has huge memory consumption If a hybrid large framework flutter directly runs on this, it will just gonna ruin the native performance of flutter
@tylerpetrov8094
@tylerpetrov8094 Год назад
If it used Python that would be awesome, but it would probably be too slow
@BottropBoy
@BottropBoy 14 дней назад
Please stop, dart is perfect
@muntasirmahmudsaif6239
@muntasirmahmudsaif6239 2 года назад
kotlin data class is way superior... will be very happy to see a native data class in dart
@sajithlaldev3354
@sajithlaldev3354 2 года назад
Use Dart Data Class Generator VS code extension to get rid of this package and headache. There is a video about the extension in my channel.
@jansprlak110
@jansprlak110 2 года назад
Beta tester od roku 2016 oceňujem
@evgeniykalaganov6753
@evgeniykalaganov6753 2 года назад
@freezed not @Freezed()
@ramsay9912
@ramsay9912 Год назад
i didnt get it, maybe because i have been into flutter for 2 months only
@blackhatvisions
@blackhatvisions 2 года назад
This is not a solution. It should have @override methods in the ide to be autofilled
@ping411
@ping411 29 дней назад
You need a lot of boilerplate to avoid to write more boilerplate
@samippaudel266
@samippaudel266 2 года назад
I missed the simple part!!!
@blablablabla29382
@blablablabla29382 2 года назад
i'm alone ? I didn't like code gen
@keithbacalso9433
@keithbacalso9433 2 года назад
why?
@blablablabla29382
@blablablabla29382 2 года назад
@@keithbacalso9433 Boilerplate, heavy maintenance, hard to replace etc
@patrickvieira9200
@patrickvieira9200 Год назад
I love the package Freezed, but man the build runner sucks
@iGhostr
@iGhostr 2 года назад
I'm just tired of these generators
@keithbacalso9433
@keithbacalso9433 2 года назад
why?
@myxzlabs5635
@myxzlabs5635 2 года назад
boilerplate should generated from IDE plugins, instead this
@StephenRoseDuo
@StephenRoseDuo 2 года назад
The true problem is that no new language should have been designed this verbose
@neuzen
@neuzen 2 года назад
It is not that new. Anyway, we could get nice DSL written in Dart, but got hardcore general purpose OOP hell.
@TheMikkelet
@TheMikkelet Год назад
"If you've come to Flutter and Dart by way of other languages, you may have noticed that Dart asks you to write a fair amount of boilerplate for simple classes" 🤡🤡🤡🤡🤡🤡 How can you not see the idiocy here
@nawshadhamid1266
@nawshadhamid1266 2 месяца назад
Dart data class is better than Kotlin 🤣🤣🤣🤣🤣🤣
@Mohamedka5116
@Mohamedka5116 2 года назад
that's still a lot of boilerplate code... Lombok did much better in Java with just annotations...
@muhammedozdogan5133
@muhammedozdogan5133 8 месяцев назад
Still too cryptic, it's not as simple as Lombok
@kharagkunchok
@kharagkunchok 2 года назад
Seems more complicated, why not provide build in support out of the box. No wonder why people hate dart.
@francisgeorge7639
@francisgeorge7639 2 года назад
That would require refection which would make tree-shaking and small binaries impossible.
@kharagkunchok
@kharagkunchok 2 года назад
@@francisgeorge7639 true but this things need to consider before even they release dart from day one. I think dart introduce lots of issues including multithreading and isolate even if it is fairly new language. Look at kotlin, how beautiful language is data class,coroutine etc P.S just saying
@francisgeorge7639
@francisgeorge7639 2 года назад
I've seen people argue that dart's flutter version (native dart has reflection) makes sense for front facing code. Seeing people complain of the web load speed could be argued either way: even with no reflection they couldn't get it small enough, or that it's still good enough as a web app even if too large for a web site.
@koldoon3279
@koldoon3279 2 года назад
@@francisgeorge7639 Bullshit. Lots of other languages and platforms solved this problem somehow and dart team also can, but this decision looks rather like some conflict with their ideology - I can't find another explanation.
@francisgeorge7639
@francisgeorge7639 2 года назад
@@koldoon3279 Why would I bullshit you? That's the explanation they have given themselves. And it makes sense to me.
@danvilela
@danvilela 2 года назад
Seems better than built_value. Horrible name though. Isn't that wrong english?
@remirousselet6867
@remirousselet6867 2 года назад
It was that or "Let it goooo"
@danvilela
@danvilela Год назад
@@remirousselet6867 Let it go it is then! Better than a typo...
@thekingssage4652
@thekingssage4652 2 года назад
ngefreez
@ben6
@ben6 2 года назад
Why don't we call it Lombok? 😂
@5erTurbo
@5erTurbo 2 года назад
Meh, a bit better I guess
@Mh-wn6ne
@Mh-wn6ne 2 месяца назад
Dart Data Plugin is more better. this package requires so many boilerplate codes and running build command.
@koldoon3279
@koldoon3279 2 года назад
Code generation is a DISASTER! Especially this "don't pay the linter too much mind"... Welcome back to 1970 and a C-language! Are you seriously suggesting to write a code blindly in 2022? that's insane. Sorry, guys, you must find better way to do all those stuff and a good native language-level reflection API is the best step towards to solving this problem and away from all these crutches.
@moazahmed5388
@moazahmed5388 2 года назад
sadly i don't like it a bit :/
@cholasimmons
@cholasimmons 2 года назад
Greek.
@BugGenerat0r
@BugGenerat0r 2 года назад
Code generation kind of sucks though...
@julius4858
@julius4858 Год назад
I hate this kind of solution so much.
@laujimmy9282
@laujimmy9282 2 года назад
Wayyyy to much of effort
@thecodeninjaeu
@thecodeninjaeu 2 года назад
Nah thanks. Don't like freezed
@asoftraiden
@asoftraiden 2 года назад
This is rubbish
@brahm-ahamasmi
@brahm-ahamasmi Год назад
Dart is great computer science but very ugly. Ugly never lasts. They should have made Flutter better to use than CSS/HTML/JS. It gets ugly by the day. Feels like they made this framework only to make it obsolete and then come up with something else.
@mustafaabozaina2787
@mustafaabozaina2787 2 года назад
So bad, I didn't love it at all. I don't recommend it
Далее
CachedNetworkImage (Package of the Week)
1:31
Просмотров 72 тыс.
Freezed ❄ - Data Class & Union in One Dart Package
36:28
Widgets vs helper methods | Decoding Flutter
6:33
Просмотров 162 тыс.
ShrinkWrap vs Slivers | Decoding Flutter
4:31
Просмотров 118 тыс.
mason (Package of the Week)
2:36
Просмотров 148 тыс.
Use Arc Instead of Vec
15:21
Просмотров 137 тыс.
How FlutterFlow Generates Flutter Code | Leigha Reid
28:38
Top 30 Flutter Tips and Tricks
6:50
Просмотров 539 тыс.
sensors_plus (Flutter Package of the Week)
2:16
Просмотров 136 тыс.
Cross-Site Request Forgery (CSRF) Explained
14:11
Просмотров 434 тыс.
Enums considered harmful
9:23
Просмотров 197 тыс.
iPhone перегрелся, что делать?!
1:01