Skip to content

nicholasspencer/observing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Observing

A simple MobX/Provider convience widget.

Usage

There are 6 generic variants of Observing so that it's compatible with Provider's Consumer. Any type may be used, not just mobx stores, as long as they're provided as an ancestor to the Observing widget of course. In fact it works with ChangeNotifierProvider as well for some real reactive programming fun.

Provider(
  create: (context) => ViewModel(),
  child: Observing<ViewModel>(
    builder: (context, viewModel) => GestureDetector(
      onTap: viewModel.increment,
      child: Text(
        viewModel.value.toString(),
        key: key,
        textDirection: TextDirection.ltr,
      ),
    ),
  ),
);

About

A MobX/Provider convenience package

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages