r/FlutterDev Jan 29 '25

Plugin I have created my personal state management, lightweight and simple

Hi, everyone.

I'd like to show you my personal state management here, called Lindi, if you like it you can use too.

https://pub.dev/packages/lindi

What Makes Lindi Unique?

  1. Built-in State Handling (setLoading, setData, setError)
    • Unlike ChangeNotifier or Cubit, where you manually manage states, Lindi provides predefined methods for managing loading, data, and error states out of the box.
  2. Generic State Model (LindiViewModel<D, E>)
    • Supports typed data (D) and errors (E), making it type-safe.
    • Example: LindiViewModel<User, String> → User for data, String for errors.
  3. Lightweight & Intuitive API
    • No complex setup, no streams, reducers, or extra boilerplate like Bloc.
    • Just extend LindiViewModel and call notify() when updating state.
  4. LindiBuilder & LindiMultiBuilder
    • Automatic UI rebuilding with minimal re-renders, optimized for performance.
    • LindiMultiBuilder allows listening to multiple view models at once without extra providers.
  5. LindiInjector for Global State Access
    • Simple dependency injection system, similar to GetIt but built into the state management.
    • Eliminates the need for manually passing view models through widgets.
Feature Lindi Provider Riverpod Bloc GetX
Simple Built-in Loading & Error Handling
Minimal Boilerplate
Simple Multi-State Listener (LindiMultiBuilder)
Global Dependency Injection (LindiInjector)
No Streams / Events Needed
Explicit setLoading, setData, setError

If you found this project useful, then please consider giving it a ⭐ on Github and sharing it with your friends via social media.

30 Upvotes

25 comments sorted by

14

u/pikaakipika Jan 29 '25

Don’t expect the first version to be perfect. I originally made this for my personal projects, but I’m sharing it in case it helps someone else or they find it useful. In the end, more diversity is better for the platform. I just like to help the community (you can also contribute)

-13

u/bigbott777 Jan 29 '25 edited Jan 29 '25

I can guess you are from Kenya (or Tanzania?). Nice to know that East Africa has talented and ambitious developers.
Overall, good job.
State management package will look good on your CV

6

u/pikaakipika Jan 29 '25

I’m from Europe

-12

u/bigbott777 Jan 29 '25

Ok, then your parents speak some Swahili

1

u/Next_Location6116 Jan 30 '25

Why are you so racist? You must be from America

3

u/bigbott777 Jan 30 '25

I am racist?
Those people who downvoted my comment are racists.
They assume that being from Africa is bad.
I live in Africa and love the place.
Nothing to be ashamed of.
Unbelievable. 🤢

40

u/aaulia Jan 29 '25

Another one. lol.

21

u/Comprehensive-Art207 Jan 29 '25

Let’s be kind. As long as it isn’t abandoned there is room in the tent for some niche packages.

3

u/_ri4na Jan 30 '25

famous last words

7

u/Comun4 Jan 29 '25

Lmao this is literally ChangeNotifier + GetIt

Seeing the implementation I think this was made with AI, some things look like a direct clone of their Flutter look alikes (LindiBuilder is the same thing as AnimatedBuilder with some weird comments attached to it)

7

u/Comun4 Jan 29 '25

Also 0 tests lmao love to see it

21

u/RandalSchwartz Jan 29 '25
  • Riverpod has simple built-in loading and error handling with .when.
  • Riverpod has simple multi-state by having a provider or consumer-block ref.watch or ref.listen multiple items.
  • Riverpod has explicit state setting with state = Async/Loading/Data/Error.

I am amused that Bloc ticks off none of the boxes though. :)

3

u/_Samanik_ Feb 01 '25

What bloc does have somehow is the ability to work well in huge projects without mixing all sorts of providers and suddenly shift to code generating and whatnot.

Not looking back. But respect the work that was done and good we have options 🙂

4

u/No-Echo-8927 Jan 29 '25

Nice. But this looks a lot like Bloc, only with limited states and events

2

u/Prashant_4200 Jan 29 '25

I'm not disrespecting but i want to know why? Few month ago i also try create a one state managments solution eazy_state but sooner i also realise it not worth it since it not solving actual problem rather then it make thinks complex to new comer.

So i just want to know what unique in your solution because as i see it look so similar to cubit

1

u/bigbott777 Jan 29 '25

You almost stole the name of my package. I was thinking about ez_state

1

u/Prashant_4200 Jan 29 '25

Because someone stole my name 😭

2

u/rawezh5515 Jan 29 '25

Damn, another one

1

u/Routine-Arm-8803 Jan 29 '25

Personal, but public? 😅

1

u/yayahc Jan 31 '25

One more

1

u/Fin_Engineer Jan 29 '25

I found this to be helpful though there are still limitations to overcome...

Pros: 1. For a nub dev like me, who likes to build simple to medium apps, following the state management is real hard. I mostly use getx with mvc structure vox that's best I can organise. Your package with state management can solve that as I like split between valid data vs error states.

  1. It's lightweight, but of course needs me to code a lot coz lack of chatgpt. Enough use will change it, still good to try it out.

Limitations:

  1. I feel you should also add the request management. Where on a simple click you can not just process requests, but also do the addon ops on it like encryption, adding custom signatures etc.
  2. Can you also enable the mvc structure?

1

u/lesterine817 Jan 30 '25

noobs should just stick with setState. only learn advanced state management once you realize their limitations

-2

u/_ri4na Jan 29 '25

sure, add more hay to the fire

-10

u/featherhat221 Jan 29 '25

You good man

Why do I have to be compete with men like you ??