Skip to content

A flutter app to showcase online shopping portal using Provider architecture. FireStore has been used as backend for this app.

Notifications You must be signed in to change notification settings

flutter-devs/flutter_shopping_portal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flutter Shopping App using Provider

A flutter app to showcase online shopping portal using Provider architecture. FireStore has been used as backend for this app.

Android Screens

iOS Screens

Provider pub package

Among multiple state management in flutter, Provider is now more powerful, flixible and easy to undersand. It has the power of managing state in efficient manager by using Consumer and Selector and now it can deals with Stream and Future also.

A mixture between dependency injection (DI) and state management, built with widgets for widgets.

Why?

It purposefully uses widgets for DI/state management instead of dart-only classes like Stream. The reason is, widgets are very simple yet robust and scalable.

Customizable

By using the power of provider we can make our own provider. Provider expose all the small components that makes a fully fledged provider.

Provider includes below widgets for customizability:

  • SingleChildCloneableWidget, to make any widget works with MultiProvider.
  • InheritedProvider, the generic InheritedWidget obtained when doing Provider.of.
  • DelegateWidget/BuilderDelegate/ValueDelegate to help handle the logic of "MyProvider() that creates an object" vs "MyProvider.value() that can update over time".

Pros of Provider

  • UI logic and business logic are clearly separated
  • Provider is customizable and gives flexibility to customize provider according to your need to boost the performance and stability.
  • Easy to understand and implement
  • Can be set up with unidirectional data flow without much difficulty, gaining the main benefit of Redux as well as provider is more powerful to handle global state.
  • Robustness, as it is harder to forget to handle the update scenario of a model/widget

Existing providers

provider exposes a few different kinds of "provider" for different types of objects.

The complete list of all the objects available is here

name description
Provider The most basic form of provider. It takes a value and exposes it, whatever the value is.
ListenableProvider A specific provider for Listenable object. ListenableProvider will listen to the object and ask widgets which depend on it to rebuild whenever the listener is called.
ChangeNotifierProvider A specification of ListenableProvider for ChangeNotifier. It will automatically call ChangeNotifier.dispose when needed.
ValueListenableProvider Listen to a ValueListenable and only expose ValueListenable.value.
StreamProvider Listen to a Stream and expose the latest value emitted.
FutureProvider Takes a Future and updates dependents when the future completes.

To read more about provider, see the documentation.

About

A flutter app to showcase online shopping portal using Provider architecture. FireStore has been used as backend for this app.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages