psk907 / fluttermoji

A light-weight and highly customizable SVG graphic set for Flutter which generates avatars and provides a Customizer Widget, personalized CircleAvatar and other utility functions.
https://pub.dev/packages/fluttermoji
MIT License
72 stars 50 forks source link

Removal of get and shared_preferences #14

Open jlnrrg opened 3 years ago

jlnrrg commented 3 years ago

This seems like a really useful package to use for a lot of people imo :+1: . Unfortunately it seems to be created for people who opt in into the getX state management. For me this makes it harder to understand how to use this library :frowning_face: .

You might want to consider removing the dependency to share_preferences and get and exposing parameters in FluttermojiCircleAvatar and FluttermojiCustomizer, so the widget can be used like flutter default widgets and leave how to save and distribute the data to the user.

(Another option might be to create a seperate package for the CircleAvatar & Customizer and then let this package depend on it, while keeping the getX and share_preferences intact.)

For reference, flutter_avatars_bottts seems to do a great job at archiving this.

psk907 commented 2 years ago

Hello @jlnrrg , This package does not require the developer to be aware of how getX state management works. In fact, I have tried to make fluttermoji a standalone module that anybody can use without worrying about state and persistence. Hence I have picked shared_preferences and get to accomplish the same.

I do however think your suggestion is better suited for advanced developers, who will love some granular control over the functioning of the package and it's integration with their own applications.

It is definitely a thought to ponder on. 💡

jlnrrg commented 2 years ago

Maybe I mixed up get and getX :smile:. I woun't call it an advanced request, more like a general: How to you pass data into and outside of this package. Lets say I have a person object, which I save in my own database, and I want to save the created avatar, how would that be possible without passing data in and out of the Widgets :question:

psk907 commented 2 years ago

I seem to get your point now, for passing data in and out of the widgets, you could use the FluttermojiFunctions class. Please check it out and let me know if it fits the use case mentioned, and any other suggestions. API Documentation: https://pub.dev/documentation/fluttermoji/latest/fluttermojiFunctions/FluttermojiFunctions-class.html

jlnrrg commented 2 years ago

I can kind of understand how to use the FluttermojiFunctions to retrieve the configured state (even though it'd probably help if the example project contained this case). But how would you pass the data into the widget again?

I agree that you created a standalone module that anyone can use without worrying about state and persistance, but in the process you also took away the possibility to let people care about that. Now with you managing the state and I managing the state in my db, there is no longer a single state of truth, which brings me back to the point of splitting the package for its selection and data saving elements :sweat_smile:. (But I understand this this would require a lot of work to be done)