Build Your Own Custom Code Generator in Flutter | Flutter Code Generation

preview_player
Показать описание
Have you ever heard of packages like Freezer, Retrofit, Riverpod Generator? They're all Code Generator built using Flutter! In this video, we are going to learn to build Code Generators like these packages by building one! This Code Generator generates constructor, fromMap, toMap, copyWith functions for a model class. All we need to do is write it once in our code (sort of like creating a template), run a command and it will generate code for all the classes we have annotated. Don't know what 'annotated' means? Watch this tutorial to know more about it.
This is my personal favourite video made on this channel till now. If you have any questions/constructive criticism about this video, let me know. I'll make sure to help you out/improve on this video.

Helpful Resources:

Connect With Me Here:
Рекомендации по теме
Комментарии
Автор

It was an amazing tutorial and this may seem redundant to most but having this on your CV can give it a huge boost and make you stand out among thousands of CVs. As Rivaan mentioned, there aren't many resources where you can learn this so it's a huge contribution to the Flutter community as well.

My only issue with video is that there is an error in the model class even after running code gen which shouldn't be there and commenting a model class used in codegen is a bad practice. No one is going to remember why they did it after a few weeks. If some GDE or expert can point out the issue and the fix, it would be really helpful and Rivaan can pin it in the comment section.

marufhassan
Автор

Riivan there is no one like you in this world, all your content are pretty valuable

dabelydadi
Автор

Every time you drop a new content, I'm eager to watch coz I know it's going to be benefiting ❤

sammyjokes
Автор

Really great explanation good job man.

md.ismailalamkhan
Автор

Super video bro.... Thanks a lot for info !!!🤟

abhayrawat
Автор

great channel and great tut, well done.

siddhant
Автор

You have a unique of teaching.
I appreciate your efforts and time for us.
I would request you to provide us a short video on bloc pattern in flutter.
That have main key points of bloc pattern.
Thanks 💌

faheemullah
Автор

I just discovered your channel, and I’m literally amused of the knowledge you covered in your videos, i have a question pls, do you have any idea about how the apps gen services (drag and drop) such as flutterflow works behind the scenes.

redaantar
Автор

really your channel is a treasure cave👌👌👌

adil_elkhallouki
Автор

cannut wait to see how far rivan will go in 2023

randomcsguy
Автор

Hey man. I love your vids.
I know your're a busy man but if you can i'd love to see a vid on intergrating flutter with openai or gtp3

raphaeljaggerd
Автор

How would I access the generic type of the annotation ex.: @MyAnnotation<Model> how do I get the Model classname. And how should I do imports in the generated code? Like how would I import the Model class?

lightgaming
Автор

Hi Rivan, thanks for the video, i have one question, how to use it in another app?

Aboelnasrmo
Автор

Amazing video rivaan

I was able to create simple generator that makes extension for class to create copyWith method without error

But unfortunately it turns out that this code doesn't work with latest plugin update i wasn't able to generate any code untill I've used your pubspec.lock file to lock to your versions 😅

I really appreciate your work if you got any new info please let us know on brief or new video for it will always be treat for eyes 🎉

dimilkalathiya
Автор

At 25 minutes, you could have used `for (final entry in visitor.fields.entries)` and then referenced entry.key and entry.value without needing to reference the original structure. Much easier to avoid an off-by-1 problem as well..

RandalLSchwartz
Автор

Nice video thanks, although india english is a battle field hahaha, anyway you have a new subscriber

zendphpcolombia
Автор

Alright, now I understand why everybody hates code generation in Dart.

Elite
Автор

at one point your command line has "flutter pub run build_runner build watch " ... not sure but I think it should be "build" or "watch" ... not both?

aktxyz
Автор

hey tell me is this an ai powered assistant for code generation??

captainbohra
Автор

Bro please make a home services app with backend..

Love from Bangladesh 🇧🇩

bossphotography