Skip to main content

Installation

Get Polly Dart up and running in your Dart or Flutter project in just a few steps.

Requirements

  • Dart SDK: 3.5.0 or higher
  • Flutter: Compatible with all Flutter versions that support Dart 3.5.0+

Adding Polly Dart to Your Project

The easiest way to add Polly Dart to your project:

dart pub add polly_dart

For Flutter projects:

flutter pub add polly_dart

Manual Installation

Alternatively, add Polly Dart manually to your pubspec.yaml:

pubspec.yaml
dependencies:
polly_dart: ^0.1.0

Then run:

dart pub get
# or for Flutter
flutter pub get

Verify Installation

Create a simple test file to verify the installation:

test_polly.dart
import 'package:polly_dart/polly_dart.dart';

void main() async {
// Create a simple pipeline
final pipeline = ResiliencePipelineBuilder()
.addRetry(RetryStrategyOptions(maxRetryAttempts: 2))
.build();

// Test it works
final result = await pipeline.execute((context) async {
print('Executing operation...');
return 'Hello, Polly Dart!';
});

print('Result: $result');
}

Run the test:

dart run test_polly.dart

You should see output like:

Executing operation...
Result: Hello, Polly Dart!

Import Statement

After installation, import Polly Dart in your Dart files:

import 'package:polly_dart/polly_dart.dart';

This single import gives you access to all the core classes:

  • ResiliencePipelineBuilder
  • ResiliencePipeline
  • ResilienceContext
  • Outcome
  • All strategy options classes

Platform Compatibility

Polly Dart is designed to work across all Dart platforms:

PlatformSupport StatusNotes
Flutter (Mobile)✅ Full SupportiOS and Android
Flutter (Web)✅ Full SupportAll strategies work
Flutter (Desktop)✅ Full SupportWindows, macOS, Linux
Dart Server✅ Full SupportAll server environments
Dart CLI✅ Full SupportCommand-line applications

Development Setup

If you're contributing to Polly Dart or want to run the examples:

Clone the Repository

git clone https://github.com/flutterninja9/polly_dart.git
cd polly_dart

Install Dependencies

dart pub get

Run Tests

dart test

Run Examples

dart run example/polly_dart_example.dart

Next Steps

Now that you have Polly Dart installed, you're ready to:

  1. 📖 Quick Start - Build your first resilience pipeline
  2. 🧠 Learn Basic Concepts - Understand the core principles
  3. 🔄 Explore Strategies - Discover all available resilience strategies

Troubleshooting

Common Issues

Issue: pub get fails with dependency resolution error

  • Solution: Ensure you're using Dart 3.5.0 or higher. Check with dart --version.

Issue: Import errors in IDE

  • Solution: Run dart pub get and restart your IDE/editor.

Issue: "Package doesn't exist" error

  • Solution: Verify you're connected to the internet and pub.dev is accessible.

Getting Help

If you encounter issues:

  1. Check the GitHub Issues for known problems
  2. Search GitHub Discussions for solutions
  3. Create a new issue with:
    • Your Dart/Flutter version (dart --version)
    • Your operating system
    • A minimal reproduction example
    • The full error message

Version Compatibility

Polly Dart VersionDart SDK VersionStatus
0.1.x≥ 3.5.0Current
Future versions≥ 3.5.0Planned

We follow semantic versioning for predictable updates.