re: Create a Todos app with Flutter and Provider VIEW POST


Hi there! Thanks for this tutorial. Don't you forget to add the provider in the main.dart file?

I had an "could not find the correct provider above this Consumer Widget" until I wrapped my HomeScreen in an MultiProvider widget:

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  Widget build(BuildContext context) {
    return MultiProvider(
        providers: [
            builder: (_) => TodoModel(),
        child: MaterialApp(
          title: 'Flutter Demo',
          theme: ThemeData(),
          home: HomeScreen(),

EDIT: it looks like you did that on the add toto page. But you should do it earlier as the empty list wont work until you add the provider ;)


Glad that you liked the tutorial.

Actually I did wrap the MaterialApp inside a ChangeNotifierProvider widget in the lib/main.dart file. We do not need to use MultiProvider because we are only using a single Provider in our app.

code of conduct - report abuse