> ## Documentation Index
> Fetch the complete documentation index at: https://confidence.spotify.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Flutter

> Confidence Flutter SDK for feature flag evaluation in cross-platform applications.

The Confidence Flutter SDK provides feature flag evaluation for Flutter applications on iOS, Android, web, and desktop platforms. Flags resolve once according to the evaluation context, and values read from a local cache for fast access.

## Features

* **Cross-platform**: Single SDK for iOS, Android, web, and desktop
* **Local caching**: Flag values cached locally for instant access
* **Automatic apply events**: Tracks flag usage
* **Managed context**: Automatic visitor ID and platform context

## Installation

Install via the Flutter CLI:

```bash theme={null}
flutter pub add confidence_flutter_sdk
```

## Quickstart

```dart theme={null}
import 'package:confidence_flutter_sdk/confidence_flutter_sdk.dart';

void main() async {
  final confidence = ConfidenceFlutterSdk();

  // Setup with API key
  await confidence.setup("your-client-secret");

  // Add context (optional)
  await confidence.putContext("targeting_key", "user-123");
  await confidence.putContext("country", "US");

  // Fetch and activate flags
  await confidence.fetchAndActivate();

  // Get flag value
  String flagValue = await confidence.getString("my-feature-flag.message", "default");
  print('Flag value: $flagValue');

  // Track custom event
  confidence.track("event-name", {});
}
```

## Resources

<CardGroup cols={2}>
  <Card title="GitHub repository" icon="github" href="https://github.com/spotify/confidence-sdk-flutter">
    Source code, examples, and full documentation
  </Card>

  <Card title="pub.dev package" icon="box" href="https://pub.dev/packages/confidence_flutter_sdk">
    Flutter package documentation
  </Card>

  <Card title="Context" icon="sliders" href="/docs/sdks/context">
    Configure evaluation context
  </Card>

  <Card title="Apply events" icon="chart-line" href="/docs/sdks/apply-event">
    Understand flag assignment tracking
  </Card>
</CardGroup>
