createProviderByPage<P extends ChangeNotifier> method Null safety

Widget createProviderByPage<P extends ChangeNotifier>(
  1. P provider(
    1. BuildContext context
    ),
  2. Widget child
)

Implementation

Widget createProviderByPage<P extends ChangeNotifier>(
  P Function(BuildContext context) provider,
  Widget child,
) {
  return ChangeNotifierProvider<P>(
    create: provider,
    builder: (_, __) {
      return child;
    },
  );
}