I don't know why, but your tutorials are the only ones that make sense to me! I had absolutely no motivation to learn all that stuff until I stumbled over your videos. Coming from Web, many packages and solutions seem to solve problems I don't know from typescript. Thank you so much! Keep up the good work! Perfectly organized information! 👌
I came here after complete watching of 1 and in other half you recommend me to watch this ..now i am feeling sleepy and washed my face and again start watching ..great video matt love you
in my opinion, for data class it is better to use plugin "Dart Data Class", it just generates all methods and construcors (including json conversion) that freezed does, you only put fields inside a class, hit generate option and that's it, less boiler code to write yourself compering to freezed, the generated code is much more cleaner
@Reso Coder How would you apply this in your Clean Architecture? I was trying to use the Freezed package with the Models & Entities but I couldn't find a way to extend the model to the entity.
Awesome video man! One question before I decide to adopt the code generation using freezed. If I change the location of the part file will it create the folder and put all the generated code in there? I want to have the generated filed in a generation folder since that code won't be manually modified. I usually have 10-20 data classes so I want to avoid having additional 2 files for each of those in the same folder.
Thanks Dane! I unfortunately couldn't find a way to organize all the generated classes into a single file without any hassle. It should be possible by passing a certain option to the build_runner and although it kind of works, the code doesn't compile afterwards 😅 You can, however, use *part of* pointing to just a single file (let's say it's called "gen_classes.dart"). Then, inside "gen_classes.dart" you will use *part 'gen_classes.freezed.dart'* as usual.
@@ResoCoder Thanks, that's a bit of a bummer. Your solution might work though. I'll maybe try that out in an upcoming project. Keep up the good videos!
When you started listing the packages at the beginning of the video... man, I felt that, it's confusing sometimes with all the packages providing workarounds for the Dart language.
Veryyyyyyy good but sealed union concept is still hard to get it :) i would need another in depth theoritical tutorial ☺️ .. any news if the dart team is about to offer native sealed unions ?
I do not know if I understand correctly. Union classes are responsible for handling use cases? For example, a document in a firestore - I am creating a union class with add, update and delete methods?
Great tutorial bro. when am using freezed with bloc library, am unable to change the state with yield keyword. How can i do so. Please make a video on freezed with bloc if possible. Thanks alot :)
You make one one the best videos. I m not able to join your bootcamps they are too price but once I accumulate that much money. I will join you one day. One question... Can I included fields like color or IconData in data class. If I do so I receive any error while running build command.
In 16:25 the serialized JSON (user.json) doesn't contain the proper formatting - missing quotations. How can we obtain a proper JSON format so that if we wanted to use that result to convert it back to it's associated object, we won't be having an "Unhandled Exception: FormatException..."?
Hey Matt, another awesome tutorial ! In your tdd clean architecture course you split your entities (with fields) and models (extending from the entity and havin fromJson and toJson methods) into the domain and the data layer. How would you do this with freezed? In my understanding you have the fields and the toJson and fromJson methods in the same class.
Good job on that, thanks a million. As I am now working on that in newer versions, I encounter the following error: it doesn't want to accept the @freezed annotation unless I use "import 'package:flutter/foundation.dart';" (While using only dart ...). Unfortunately it builds then, but doesn't run... Don't know why the example wont work ... Just in case you have time to answer I happily appreciate that !
Nice tutorial as always and great package for missing Dart features! I am starting a project with Flutter / AngularDart and was wondering if i can use Freezed package in my shared code for AngularDart!
What part of bluetooth did you want? There's flutterblue or bluetooth_serial libraries - flutterblue has a few good tutorials already and serial has pretty good documentation.
how to run it? i created flutter app and there is no way to print for example "SomeClass() = SomeClass()" to get this error from 5:28, you are not working in flutter aplication, right?
How to enable the parameter completion? For example. in 15:56 when you press enter in User.fromJson() the argument JSON was auto-filled. In my case, the autocomplete only completes up to User.fromJson. Event the parenthesis is not completed while pressing TAB or ENTER
Hi Reso Coder. i had question, Can you fully substitute built_value with freezed? Does freezed cover all the serialization and deserialization of built_value?
And by covering all of that I mean for example I use built value with a custom deserialization because I am using it with chopper and I have an end point that Some of it’s fields types changes under some circumstances and I costumed the deserialization method. Can you do this customization with this? And can you use freezed with chopper?
Great video as always! Thank you. Could you please make a tutorial on how to use freezed with mobx especially for consuming API/json and building the UI conditionally with sealed class which will return widgets (loading, initial, error, hasData, noData, etc). Or is it unnecessary? Better to do it with plain old dart stateless widgets based on mobx store state?
hi mat, great videos. have you done any AR app development. if so (or not) is there a library you would recommend using for AR that works both on Android and IOS
I just finished implementing one core part of the project. I hope to get the project done by the end of the week and then I'm off to making the actual articles and videos.
cool and all, but makes the code more confusing. Imagine if you don't know about freezed and browse someone's code who is using it. You'll spend 1h reasoning about (probably 36 minutes watching this video). Maybe it's better if dart doesn't support everything.
"flutter pub run build_runner watch --delete-conflicting-outputs" doesn't generate the files. It runs and succeeds. but with 0 output and (0 actions). what to do?
I had to watch another tutorial to find the solution, you need the freezed_annotation package in the pubspec.yaml file and also change the @immutable in the freezed_classes.dart file to @freeze and import the freeze_anotation package into that file. Hope this helps
@@morapedimasima9753 I m having the same issue, but not able to resolve it via your solution. Can you share the link to tutorial, maybe i m missing something else
@@soulstonefilms I watched this video th-cam.com/video/pI6cXMmXBkA/w-d-xo.html&ab_channel=RobertBrunhage . Just make sure you running the latest version of flutter and also update the other 3 packages that are required and should be up to date. if that doesn't work then try and read the documentation here pub.dev/packages/freezed It also helped me understand more about what's happening.
Sadly there is an issue with build runner that it doesn't see other files .part. Because of that isn't possible to use mobx observables of generated classes. And I'm using mobx for state management :/
I've just tested to make sure. I can confirm that it does indeed work. To begin with, that's the reason why Freezed uses `*.freezed.dart` instead of `*.g.dart`
@@FilledStacks Not with the part keyword. It should be feasible by relying on `import` instead of `part` though. But you can make that change yourself using the build.yaml and a few extra steps
i have problem for dev_dependencies structure: dev_dependencies: --flutter_test: ----sdk: flutter --build_runner: --freezed: ^0.10.4 --json_serializable: ^3.2.5 - is a space, or tab whit that structure pub get tell me: Error on line 35, column 3 of pubspec.yaml: A package may not list itself as a dependency. pub get failed (65; ╵) 35 │ freezed: ^0.10.4 Somebody can help me, please? francyfre
@@francescofreddi4374 Did you resolve your issue? When I run the pub run watch command it ends with: [INFO] Succeeded after 121ms with 0 outputs (2 actions) But the freezed_classes.freezed.dart file is not generated.
Imagine if the developers of dart weren't so dumb with their "oh, but the programmers are so dumb (not us though), these neseted classes will only confuse them" nonsense.
This tutorial *WORKS* even with the new version *0.6*
Just use the @freezed annotation from the *freezed_annotation* package.
please mention it in the video
I don't know why, but your tutorials are the only ones that make sense to me! I had absolutely no motivation to learn all that stuff until I stumbled over your videos. Coming from Web, many packages and solutions seem to solve problems I don't know from typescript. Thank you so much! Keep up the good work! Perfectly organized information! 👌
Thank you so much @Reso Coder
This is so concise, clear, and convenient! Thanks, Reso Coder!!!! Love it
I came here after complete watching of 1 and in other half you recommend me to watch this ..now i am feeling sleepy and washed my face and again start watching ..great video matt love you
in my opinion, for data class it is better to use plugin "Dart Data Class", it just generates all methods and construcors (including json conversion) that freezed does, you only put fields inside a class, hit generate option and that's it, less boiler code to write yourself compering to freezed, the generated code is much more cleaner
Freezed is so beautiful
I love the way to tell us where to use it in real application.
great job, be continued.
your videos is extremely useful
ok I finally get unions and a useful way to use them and it is brilliant. TY for this tutorial!
Good job, Reso 💙
best video about freeze package
Thanks for this fast clear summary. :-)
@Reso Coder How would you apply this in your Clean Architecture? I was trying to use the Freezed package with the Models & Entities but I couldn't find a way to extend the model to the entity.
@Mark, did you get it? I'm trying to do the same thing. Please, let me know!
I am convinced this is going to be useful
Ur doing an awesome work bro ..........loved ur voice nd ur way of teaching...❤️..............for me this is the best flutter channel ❤️🔥🔥
Without watching your video liked it.
Awesome video man! One question before I decide to adopt the code generation using freezed. If I change the location of the part file will it create the folder and put all the generated code in there? I want to have the generated filed in a generation folder since that code won't be manually modified. I usually have 10-20 data classes so I want to avoid having additional 2 files for each of those in the same folder.
Thanks Dane! I unfortunately couldn't find a way to organize all the generated classes into a single file without any hassle. It should be possible by passing a certain option to the build_runner and although it kind of works, the code doesn't compile afterwards 😅
You can, however, use *part of* pointing to just a single file (let's say it's called "gen_classes.dart"). Then, inside "gen_classes.dart" you will use *part 'gen_classes.freezed.dart'* as usual.
@@ResoCoder Thanks, that's a bit of a bummer. Your solution might work though. I'll maybe try that out in an upcoming project. Keep up the good videos!
@@ResoCoder There is an option in VSCode which allows you to hide part files from the explorer in the left pane. Maybe this will help?
Thank you, very useful! I have a question if sombody could answer: Is possible to declare once the shared fields between unions?
I watched this read the doc many times , now safely I can say getting hang of it.
`flutter pub run build_runner watch --delete-conflicting-outputs` from where do we know more about this cmd ?
great video :) ty
Comes from the builder_runner package. Very common for any package like freezed or json_serializer for code generation
When you started listing the packages at the beginning of the video... man, I felt that, it's confusing sometimes with all the packages providing workarounds for the Dart language.
It's getting better, fortunately.
Very nice, but can we separate on domain and model? like clear architecture?
Veryyyyyyy good but sealed union concept is still hard to get it :) i would need another in depth theoritical tutorial ☺️ .. any news if the dart team is about to offer native sealed unions ?
Nice. Like this and i'm thinking about built_value and sealed classes now... racing between packages? :))
I do not know if I understand correctly. Union classes are responsible for handling use cases? For example, a document in a firestore - I am creating a union class with add, update and delete methods?
Excellent tutorials!
Great tutorial bro. when am using freezed with bloc library, am unable to change the state with yield keyword. How can i do so. Please make a video on freezed with bloc if possible. Thanks alot :)
You make one one the best videos.
I m not able to join your bootcamps they are too price but once I accumulate that much money. I will join you one day.
One question...
Can I included fields like color or IconData in data class. If I do so I receive any error while running build command.
looks good, but I guess I will wait for asts and data classes to land in dart :)
In 16:25 the serialized JSON (user.json) doesn't contain the proper formatting - missing quotations. How can we obtain a proper JSON format so that if we wanted to use that result to convert it back to it's associated object, we won't be having an "Unhandled Exception: FormatException..."?
Question, can I change the the json field in method fromJson? Like when my app want to get a phone field, but the data from json is 'userid'
Hey Matt, another awesome tutorial ! In your tdd clean architecture course you split your entities (with fields) and models (extending from the entity and havin fromJson and toJson methods) into the domain and the data layer. How would you do this with freezed? In my understanding you have the fields and the toJson and fromJson methods in the same class.
Hi Dennis, have you figured out how to use Freezed in the tdd clean architecture tutorial?
@@markoliverbaltazar9764 Yes, I just combined booth in the data layer as model
Good job on that, thanks a million. As I am now working on that in newer versions, I encounter the following error: it doesn't want to accept the @freezed annotation unless I use "import 'package:flutter/foundation.dart';" (While using only dart ...). Unfortunately it builds then, but doesn't run... Don't know why the example wont work ...
Just in case you have time to answer I happily appreciate that !
Nice tutorial as always and great package for missing Dart features! I am starting a project with Flutter / AngularDart and was wondering if i can use Freezed package in my shared code for AngularDart!
please make some video about best practice in writing complex apss
Thanks for this video, u help me alot. Could you make a tutorial implementing bluetooth with flutter ?
What part of bluetooth did you want? There's flutterblue or bluetooth_serial libraries - flutterblue has a few good tutorials already and serial has pretty good documentation.
@@gerardragbir Im trying to make a chat app with bluetooth and i tried those packages but they didn't work in my project .
Good job man.
Change @immutable to @freezed in the VS Code snippet code provided by Matt
why?
thank you, it worked after i change to @freezed and freezed_annotation package.
how to run it? i created flutter app and there is no way to print for example "SomeClass() = SomeClass()" to get this error from 5:28, you are not working in flutter aplication, right?
How to enable the parameter completion? For example. in 15:56 when you press enter in User.fromJson() the argument JSON was auto-filled. In my case, the autocomplete only completes up to User.fromJson. Event the parenthesis is not completed while pressing TAB or ENTER
thank you a lot!!!
Hi Reso Coder. i had question, Can you fully substitute built_value with freezed? Does freezed cover all the serialization and deserialization of built_value?
And by covering all of that I mean for example I use built value with a custom deserialization because I am using it with chopper and I have an end point that Some of it’s fields types changes under some circumstances and I costumed the deserialization method. Can you do this customization with this? And can you use freezed with chopper?
Freezed uses json_serializable, so if you can make your data work with that package, you're good. It should work with Chopper just fine.
Great Tutorial. Sir how are you running the main function without running any emulator?
Hello, have you found that out by any chance?
@@alexandrufilipescu1301 Actually yes. We need to remove flutter sdk from pubspec.yaml and run as a plain dart program
@@rubinbajracharya9319 Thank you!
Great video as always! Thank you. Could you please make a tutorial on how to use freezed with mobx especially for consuming API/json and building the UI conditionally with sealed class which will return widgets (loading, initial, error, hasData, noData, etc). Or is it unnecessary? Better to do it with plain old dart stateless widgets based on mobx store state?
fire.... 🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥
You are Awesome
I'm facing problem it says error no 78.
😔
Without it gives Bad State: Unexpected Diagnostics ... expected an identifier ... any idea why this occurs
Hello. Could you please tell me the font family that you are using in your IDE?
JetBrains Mono but nearly bold (Victor Mono is similar and also good:)
Is there a way to implement generic JsonConverter for Chopper using Freezed?
hmm let's have a look. thanks. ;)
hi mat, great videos. have you done any AR app development. if so (or not) is there a library you would recommend using for AR that works both on Android and IOS
Hey, it's possible to do a video using mobx and hive together? i'm really interested how can i use both together
Is it possible to use freezed with JsonKey annotation?
waiting for bLOC with Freeze
🔥🔥🔥🔥🔥
Pleaaaase please please please make a tutorial using Freezes with flutter_bloc 🤞🙏
Also, great tutorial! Much appriciated!
I'm just preparing a series where we will use it.
at 8:02 you wrote _$User what is the meaning of _$ anyone??
I know you have a busy schedule but any expectations about the release date of the series you said you had in the works?
I just finished implementing one core part of the project. I hope to get the project done by the end of the week and then I'm off to making the actual articles and videos.
@@ResoCoder Best of luck, Matt. I'm so excited for it, your tutorials are the best out there 💙
Bro can u do an tutorial for admob reward vedio .....plzzz.........love from India ❤️
cool and all, but makes the code more confusing. Imagine if you don't know about freezed and browse someone's code who is using it. You'll spend 1h reasoning about (probably 36 minutes watching this video). Maybe it's better if dart doesn't support everything.
"flutter pub run build_runner watch --delete-conflicting-outputs" doesn't generate the files. It runs and succeeds. but with 0 output and (0 actions). what to do?
try to create new project and repeat
I had to watch another tutorial to find the solution, you need the freezed_annotation package in the pubspec.yaml file and also change the @immutable in the freezed_classes.dart file to @freeze and import the freeze_anotation package into that file. Hope this helps
@@morapedimasima9753 I m having the same issue, but not able to resolve it via your solution. Can you share the link to tutorial, maybe i m missing something else
I added part 'yourclassname.g.dart' and ran the command. this worked for me, 2 files were generated, i deleted the .g.dart file that got generated.
@@soulstonefilms I watched this video th-cam.com/video/pI6cXMmXBkA/w-d-xo.html&ab_channel=RobertBrunhage . Just make sure you running the latest version of flutter and also update the other 3 packages that are required and should be up to date. if that doesn't work then try and read the documentation here pub.dev/packages/freezed
It also helped me understand more about what's happening.
Sadly there is an issue with build runner that it doesn't see other files .part. Because of that isn't possible to use mobx observables of generated classes. And I'm using mobx for state management :/
It should work actually. Freezed doesn't rely on part files.
I've just tested to make sure.
I can confirm that it does indeed work.
To begin with, that's the reason why Freezed uses `*.freezed.dart` instead of `*.g.dart`
@@remirousselet6867 woooow! Great! Thank you for that! Now I'll use it!
@@remirousselet6867 Can we make the generated files go into a different folder automatically?
@@FilledStacks Not with the part keyword. It should be feasible by relying on `import` instead of `part` though.
But you can make that change yourself using the build.yaml and a few extra steps
Why you call map a json?
i have problem for dev_dependencies structure:
dev_dependencies:
--flutter_test:
----sdk: flutter
--build_runner:
--freezed: ^0.10.4
--json_serializable: ^3.2.5
- is a space, or tab
whit that structure pub get tell me:
Error on line 35, column 3 of pubspec.yaml: A package may not list itself as a dependency.
pub get failed (65; ╵) 35 │ freezed: ^0.10.4
Somebody can help me, please?
francyfre
i try to solved with this structure:
dependencies:
flutter:
sdk: flutter
json_annotation: ^3.0.1
meta: ^1.1.8
freezed: ^0.9.3
dev_dependencies:
flutter_test:
sdk: flutter
build_runner:
json_serializable: ^3.2.5
flutter puckages get functions!!!!, BUT......
freezed finisch with 0 outputs: Succeeded after 89ms with 0 outputs (0 actions)
@@francescofreddi4374 Did you resolve your issue? When I run the pub run watch command it ends with:
[INFO] Succeeded after 121ms with 0 outputs (2 actions)
But the freezed_classes.freezed.dart file is not generated.
@@devorrahtester5439 i am forgotren about :) :) :)
Imagine if the developers of dart weren't so dumb with their "oh, but the programmers are so dumb (not us though), these neseted classes will only confuse them" nonsense.
iOS developers needs to Google everything first
# the following fixes a freezed dependency problem github.com/flutter/flutter/issues/63556
dependency_overrides:
analyzer: '0.39.14'
or modify analysis_options.yaml:
and add those lines :
analyzer:
exclude:
- "**/*.g.dart"
- "**/*.freezed.dart"