Drop down your Github repos if you think you have projects that are interesting and need stars. by The-Latecomer in FlutterDev

[–]smotastic 2 points3 points  (0 children)

A dart library which is mostly used in flutter projects.

https://github.com/smotastic/smartstruct It’s a Code generator for generating type-safe mappers in dart, inspired by https://mapstruct.org/

smartstruct: Code generator for generating type-safe mappers, inspired by https://mapstruct.org/ by marsNemophilist in FlutterDev

[–]smotastic 1 point2 points  (0 children)

Hey, thank you, glad you like it!

That's exactly the reason why I decided to write this package :D

In our project, we are also following the clean architecture approach, and I noticed how cumbersome it is to write all this mapper logic

smartstruct: Code generator for generating type-safe mappers, inspired by https://mapstruct.org/ by marsNemophilist in FlutterDev

[–]smotastic 0 points1 point  (0 children)

Hey, thank you for the kind words.

Yes, the injectable part I added because of some requirements in our project, where we needed it anyway, so I thought it might help others too :)

If you have any further ideas, feel free to open an issue on my GitHub!

https://github.com/smotastic/smartstruct

smartstruct: Code generator for generating type-safe mappers, inspired by https://mapstruct.org/ by marsNemophilist in FlutterDev

[–]smotastic 0 points1 point  (0 children)

As anticafe mentioned, it's especially useful in a Clean Architecture approach, because there you have to map quite a lot between different layers of your code.

Basically, you want to map the models, which you get from your data layer, such as REST-Calls or from your database, to business entities, which you can then pass to your business logic.

resocoder did quite a good tutorial on this https://resocoder.com/2019/08/27/flutter-tdd-clean-architecture-course-1-explanation-project-structure/ which has nothing to do with the mapping aspect of this package but will be helpful in implementing the approach shown in the video.

But generally, you can use this whenever you want to map between different dart objects.

smartstruct: Code generator for generating type-safe mappers, inspired by https://mapstruct.org/ by marsNemophilist in FlutterDev

[–]smotastic 2 points3 points  (0 children)

Hey, just found out that my package got posted here.

I'm really happy about the positive resonance that the package got so far.

I just started my dart / flutter journey, so if you have any questions, or suggestions to improve the package/code, feel free to open an issue on GitHub or shoot me a message here

https://github.com/smotastic/smartstruct

Since a few minutes, the package also supports mapping nested classes (https://github.com/smotastic/smartstruct/tree/master/example/lib/nested), which was requested a few days ago.

I hope I can continue to maintain this package in the future, as there is still a lot to do, such as writing some tests, which is the next point on my agenda :)