🚨 Common Flutter Mistake: `riverpod` vs `flutter_riverpod`
Vrushali

Vrushali @vrushali_dev_15

About: Android Dev 👩‍💻 | Java, Kotlin, Jetpack Compose, Dart & Flutter

Location:
India
Joined:
Jun 26, 2025

🚨 Common Flutter Mistake: `riverpod` vs `flutter_riverpod`

Publish Date: Jul 16
0 0

“Why isn’t ConsumerWidget working?!”

Been there? So was I — and here’s what I learned 👇


❌ The Mistake

I added this to my pubspec.yaml:

yaml
dependencies:
  riverpod: ^2.0.0
Enter fullscreen mode Exit fullscreen mode

It installed without error. But suddenly, ConsumerWidget wasn’t available, ref.watch() threw errors, and I couldn’t use ProviderScope.

I thought Riverpod was broken... until I realized my mistake. 😅

✅ The Fix
So, fix your pubspec.yaml like this:

dependencies:
  flutter_riverpod: ^2.5.1
Enter fullscreen mode Exit fullscreen mode

Then import it in your Dart files:
import 'package:flutter_riverpod/flutter_riverpod.dart';

🧠 Bonus Tip
Don't forget to wrap your app with ProviderScope in main.dart:

void main() {
  runApp(ProviderScope(child: MyApp()));
}
Enter fullscreen mode Exit fullscreen mode

Without this, providers won’t work — even with the correct package.

🧵 TL;DR
If you're using Riverpod in Flutter and ConsumerWidget or ref.watch() isn't working:

You likely added riverpod instead of flutter_riverpod

Fix your pubspec.yaml

Save yourself from unnecessary debugging 😅

💬 Your Turn
Have you made this mistake before?
Got other Riverpod or Flutter setup tips?

Let’s chat in the comments 👇

Comments 0 total

    Add comment