Installation

Get started with Riverpod Gen Shortcuts in your Flutter project. This guide covers everything from basic setup to advanced configuration.

Prerequisites

Before installing, make sure you have:

Step 1: Add Dependencies

Add the following dependencies to your pubspec.yaml:

pubspec.yaml
dependencies:
  flutter:
    sdk: flutter
  flutter_riverpod: ^2.4.9
  riverpod_annotation: ^2.3.3

dev_dependencies:
  flutter_test:
    sdk: flutter
  build_runner: ^2.4.7
  riverpod_generator: ^2.3.9
  riverpod_lint: ^2.3.7

Step 2: Run Build Runner

Install dependencies and set up code generation:

terminal
flutter pub get
dart run build_runner build

Step 3: Configure VS Code (Optional)

For the best development experience, install the Riverpod snippets extension for VS Code. This adds intelligent code completion and shortcuts.

VS Code Extension Installation Demo
Installing the Riverpod Snippets extension in VS Code

Step 4: Verify Installation

Create a simple provider to verify everything works:

counter.dart
import 'package:riverpod_annotation/riverpod_annotation.dart';

part 'counter.g.dart';

@riverpod
class Counter extends _$Counter {
  @override
  int build() => 0;

  void increment() => state++;
}

Run the build runner to generate the provider:

terminal
dart run build_runner build

🎉 You're Ready!

Installation complete! You can now start using Riverpod with code generation. Check out our Quick Start guide to build your first provider.