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

# Flutter SDK

> Integrate Fingerprint device intelligence into your Flutter apps on Android, iOS, and web.

The [Fingerprint Flutter SDK](https://github.com/fingerprintjs/flutter) is an official open-source Fingerprint plugin for Flutter apps. It supports Android, iOS, and web. The package is published on pub.dev as [`fingerprint_flutter`](https://pub.dev/packages/fingerprint_flutter). See the [Flutter quickstart](https://docs.fingerprint.com/docs/flutter-quickstart.md) for a step-by-step guide.

> [!NOTE]
>
> Upgrading from SDK v4? The package is renamed from `fpjs_pro_plugin` to `fingerprint_flutter`, and the API has breaking changes. See [Migrating the Flutter SDK from v4 to v5](https://docs.fingerprint.com/docs/flutter-migrating-from-v4-to-v5.md).

## Requirements

The Flutter SDK uses the v4 [Android](https://docs.fingerprint.com/docs/android-sdk.md) and [iOS](https://docs.fingerprint.com/docs/ios-sdk.md) SDKs under the hood, but its minimum versions can be higher than theirs. It requires:

* Flutter 3.44.0 or higher
* Dart 3.12.0 or higher
* Android 7.0 (API level 24) or higher, as required by Flutter 3.44.
* For Android apps on Android Gradle plugin (AGP) 8: Kotlin Gradle plugin 2.2.20 or higher
* iOS 15/tvOS 15 or higher, Xcode 16 or higher, Swift 6 or higher

## 1. Install the plugin

Add `fingerprint_flutter` to the `pubspec.yaml` file in your Flutter app:

```yaml pubspec.yaml theme={"theme":"github-dark-dimmed"}
dependencies:
  flutter:
    sdk: flutter
  ...
  fingerprint_flutter: ^5.2.0
```

Run `flutter pub get` to download and install the package.

To use this plugin on the web, add the JavaScript agent loader `<script>` tag to the `<head>` of your HTML template inside the `web/index.html` file:

```html web/index.html theme={"theme":"github-dark-dimmed"}
<head>
  <!-- ... -->
  <script src="assets/packages/fingerprint_flutter/web/index.js" defer></script>
</head>
```

## 2. Identify visitors

Create the client in `main()` so the native client starts at app launch. The constructor is synchronous. You don't need to `await` it.

```dart Dart theme={"theme":"github-dark-dimmed"}
import 'package:flutter/material.dart';
import 'package:fingerprint_flutter/fingerprint_flutter.dart';

late final Fingerprint fingerprint;

void main() {
  WidgetsFlutterBinding.ensureInitialized();

  fingerprint = Fingerprint(
    apiKey: 'PUBLIC_API_KEY',
    region: Region.us, // or Region.eu, Region.ap
  );

  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
    identify();
  }

  Future<void> identify() async {
    try {
      final result = await fingerprint.get();
      debugPrint('Visitor ID: ${result.visitorId}');
      debugPrint('Event ID: ${result.eventId}');
    } on FingerprintError catch (error) {
      debugPrint('Error identifying visitor: $error');
    }
  }

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(home: Scaffold());
  }
}
```

To try it, replace the contents of `lib/main.dart` in a new Flutter app with this snippet and set your public API key.

### Documentation

You can find the full documentation in the [official GitHub repository](https://github.com/fingerprintjs/flutter). The repository also contains [an example app](https://github.com/fingerprintjs/flutter/tree/main/example) demonstrating usage of the library.
