RepositoryProvider<T> constructor

  1. {Key key,
  2. @required Create<T> create,
  3. Widget child,
  4. bool lazy}

Takes a Create function that is responsible for creating the repository and a child which will have access to the repository via RepositoryProvider.of(context). It is used as a dependency injection (DI) widget so that a single instance of a repository can be provided to multiple widgets within a subtree.

  create: (context) => RepositoryA(),
  child: ChildA(),

Lazily creates the repository unless lazy is set to false.

  lazy: false,`
  create: (context) => RepositoryA(),
  child: ChildA(),


  Key key,
  @required Create<T> create,
  Widget child,
  bool lazy,
}) : super(
        key: key,
        create: create,
        dispose: (_, __) {},
        child: child,
        lazy: lazy,