> ## 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

<Note>
  This page covers Flutter SDK v4 (`fpjs_pro_plugin`), which uses the v2 Android and iOS SDKs and JavaScript agent v3. For the current version, see [Flutter SDK](/docs/flutter) and [Migrating the Flutter SDK from v4 to v5](/docs/flutter-migrating-from-v4-to-v5).
</Note>

Fingerprint Flutter is an [official open-source library](https://github.com/fingerprintjs/flutter/tree/v4.13.1) for the Flutter ecosystem. The package is also published at [pub.dev](https://pub.dev/packages/fpjs_pro_plugin) package repository. This library supports Android, iOS, and web platforms. View our [Flutter quickstart](/docs/v3/flutter-quickstart) for a step-by-step guide to get started.

## Requirements

The Flutter SDK uses the [Android](/docs/native-android-integration) and [iOS](/docs/ios) SDKs under the hood, so it has the same minimum OS version requirements:

* Android 6.0 (API level 23+) or higher
* iOS 13+/tvOS 15+, Swift 5.9 or higher
* Flutter 3.19 or higher
* Dart 3.3 or higher

## 1. Install the plugin

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

```yaml YAML theme={"theme":"github-dark-dimmed"}
dependencies:
  flutter:
    sdk: flutter
  ...
  fpjs_pro_plugin: ^4.13.1
```

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 HTML theme={"theme":"github-dark-dimmed"}
<head>
  <!-- ... -->
  <script src="assets/packages/fpjs_pro_plugin/web/index.js" defer></script>
</head>
```

## 2. Identify visitors

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

void main() {
  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();
    initFingerprint();
  }

  // Initialize Fingerprint
  void initFingerprint() async {
    await FpjsProPlugin.initFpjs(
      'PUBLIC_API_KEY', // insert your API key here
      region: Region.us, // Insert the data region of your Fingerprint workspace
    );
    identify();
  }

  // Identify visitor
  void identify() async {
    try {
      final visitorData = await FpjsProPlugin.getVisitorData();
      debugPrint('Visitor ID: ${visitorData.visitorId}');
      debugPrint('Request ID: ${visitorData.requestId}');
    } on FingerprintProError catch (e) {
      // Process the error
      debugPrint('Error identifying visitor: $e');
    }
  }

  @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 for v4 in the [official GitHub repository](https://github.com/fingerprintjs/flutter/tree/v4.13.1). The repository also contains [an example app](https://github.com/fingerprintjs/flutter/tree/v4.13.1/example) demonstrating usage of the library.
