Skip to content

ViewModel enables Flutter developers to write cleaner code by using the lifecycle-aware viewmodel class

License

Notifications You must be signed in to change notification settings

donut-gives/tadpole

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Library to easily manage ViewModels aka controller classes in Flutter that bounded to the lifecycle of the widget.

Features

  • Three Viewmodel APIs in ViewModeMixin for State.

    1. registerViewModel(create: ()=>ViewModel()) - instead of passing a viewmodel instance that is created from outside, we pass a function create to tell this API how to create a viewmodel.
    2. registerSharedViewModel(key: someStringConstant, createIfNull: ()=>ViewModel()) - this API shares viewmodel using the key which is a String constant. If the viewmodel associated with key is not already created anywhere in the application, a new viewmodel is created using the function createIfNull and stored
    3. getViewModel() - this finds and returns the viewmodel registered in the parent widget.
  • For Widgets, that only need the access to the viewmodel registered in the parent, we have ViewModelProviderMixin for Widget

Additional information

This library is maintained by Developers at Donut.

About

ViewModel enables Flutter developers to write cleaner code by using the lifecycle-aware viewmodel class

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages