An helper to easily exposes a value using InheritedWidget without having to write one.

This is especially useful with patterns such as BLoC or when storing our state inside InheritedWidget. As having to manually write a StatefulWidget AND an InheritedWidget can be tedious.


Provider usage:

import 'package:provider/provider.dart';

main() {
      value: 42,
      child: Builder(
        builder: (context) => {
          // explicitly pass the generic type
          final value = Provider.of<int>(context);

          // type inference works too:
          int value2;
          value2 = Provider.of(context);

          // do something with it

StatefulProvider usage

class Model {}

class Stateless extends StatelessWidget {
  Widget build(BuildContext context) {
    return StatefulProvider(
      // we voluntary reuse the previous value
      valueBuilder: (Model old) =>  old ?? Model(),
      // child: ...,


Support for doing something awesome. [...]