Skip to main content
⚠️The documentation for version 2.0 is in progress. A preview is available at:

Getting started

Before diving into the inner mechanisms of Riverpod, let's start with the basics: Installing Riverpod, then writing a "Hello world".

What package to install

Before anything, you need to be aware that Riverpod is spread across multiple packages, with slightly different usage.
The variant of Riverpod that you will want to install depends on the app you are making.

You can refer to the following table to help you decide which package to use:

app typepackage namedescription
Flutter onlyflutter_riverpodA basic way of using Riverpod with flutter.
Flutter + flutter_hookshooks_riverpodA way to use both flutter_hooks and Riverpod together.
Dart only (No Flutter)riverpodA version of Riverpod with all the classes related to Flutter stripped out.

Installing the package

Once you know what package you want to install, proceed to add the following to your pubspec.yaml:

sdk: ">=2.17.0 <3.0.0"
flutter: ">=3.0.0"

sdk: flutter
flutter_hooks: ^0.18.0
hooks_riverpod: ^2.4.0

Then run flutter pub get.

That's it. You've added Riverpod to your app!

Usage example: Hello world

Now that we have installed Riverpod, we can start using it.

The following snippets showcase how to use our new dependency to make a "Hello world":

import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';

// We create a "provider", which will store a value (here "Hello world").
// By using a provider, this allows us to mock/override the value exposed.
final helloWorldProvider = Provider((_) => 'Hello world');

void main() {
// For widgets to be able to read providers, we need to wrap the entire
// application in a "ProviderScope" widget.
// This is where the state of our providers will be stored.
child: MyApp(),

// Note: MyApp is a HookConsumerWidget, from hooks_riverpod.
class MyApp extends HookConsumerWidget {

Widget build(BuildContext context, WidgetRef ref) {
final String value =;

return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('Example')),
body: Center(
child: Text(value),

Which you can then execute with flutter run.
This will render "Hello world" on your device.

Going further: Installing code snippets

If you are using Flutter and VS Code , consider using Flutter Riverpod Snippets

If you are using Flutter and Android Studio or IntelliJ, consider using Flutter Riverpod Snippets


Choose your next step

Learn some basic concepts:

Follow a cookbook: