Getting Started

Installation

Learn how to add Shard to your Flutter project.

Adding Shard to Your Project

Step 1: Add Dependency

Add Shard to your pubspec.yaml file:

dependencies:
  flutter:
    sdk: flutter
  shard: ^2.0.0-dev.1
A ^2.0.0-dev.1 constraint opts into the 2.0 development release. Pin an exact version (for example shard: 2.0.0-dev.1) if you prefer stability.

Step 2: Install Dependencies

Run the following command to install the package:

flutter pub get

Step 3: Import Shard

Import Shard in your Dart files:

import 'package:shard/shard.dart';

Test utilities live in a separate import that you use from your tests:

import 'package:shard/shard_test.dart';

Timer-based tests (debounce/throttle) pair well with the fake_async dev dependency.

Learning path

Follow the docs in this order for a step-by-step experience:

  1. Getting StartedIntroduction → Installation → Quick Start
  2. EssentialsCore ConceptsWidgetsAsync ValuesResponse CachingObserving a ShardShardLocatorUndo & RedoTesting
  3. All ShardsFutureShardStreamShardCommandShardComputedShardPersistent Shard
  4. ExamplesTodo AppInfinite ScrollCommandShard FormBest Practices
  5. MigrationWhat's NewMigrating from 1.x

Next Steps

Next: Quick Start to build your first shard. See also: Core Concepts for the fundamentals.