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

# Install

> Add the Insito Flutter SDK to your app in one command and fire your first trigger.

The SDK ships as a single pub.dev package: [`insito_flutter`](https://pub.dev/packages/insito_flutter).
It works in any Flutter app — iOS, Android, and the other Flutter targets.

## Requirements

| Dependency | Minimum version |
| ---------- | --------------- |
| Flutter    | 3.27            |
| Dart       | 3.6             |

The package pulls in `http` and `shared_preferences` transitively — no extra
setup is required. `shared_preferences` backs the persistent response queue, so
responses survive bad networks and app cold-starts.

## Install

<CodeGroup>
  ```bash flutter theme={null}
  flutter pub add insito_flutter
  ```

  ```yaml pubspec.yaml theme={null}
  dependencies:
    insito_flutter: ^0.1.1
  ```
</CodeGroup>

Then run `flutter pub get` (the `flutter pub add` command does this for you).

## Initialise the SDK

`MicroSurvey.init()` boots the singleton. Call it **once**, as early as
possible — the top of `main()` is ideal. It's `async` because it seeds the
offline queue, screen-map timer, and per-install counters.

```dart main.dart theme={null}
import 'package:flutter/material.dart';
import 'package:insito_flutter/insito_flutter.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await MicroSurvey.init(
    const InsitoConfig(
      apiKey: 'proj_xxx',
      debug: true, // set from kDebugMode in real apps
    ),
  );

  runApp(const MyApp());
}
```

`init()` validates the key (`proj_xxx` format) and throws if it's malformed —
easier to catch in development than a delayed network error.

## Wire up the provider

`InsitoProvider` is the widget that renders the survey modal above your app.
Wrap it around your `MaterialApp` (or `WidgetsApp`/`CupertinoApp`).

```dart main.dart theme={null}
class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return InsitoProvider(
      child: MaterialApp(
        home: const HomeScreen(),
      ),
    );
  }
}
```

<Note>
  `InsitoProvider` renders the modal as a sibling of your app and supplies its
  own `Directionality`, `MediaQuery`, `Localizations`, `Theme`, and `Overlay`,
  so it works no matter where you mount it in the tree.
</Note>

## Identify your user

Once a user signs in (or as early as you have a stable `userId`), call
`identify()`. The SDK caches identity for 24 hours, so repeat sessions are free.

```dart theme={null}
await MicroSurvey.identify(
  const UserProperties(
    userId: 'user-from-your-auth-system',
    platform: 'ios',
    appVersion: '1.0.0',
  ),
);
```

## Fire a trigger

At any key moment, fire a trigger by name. The server decides whether a survey
is eligible; if it is, the modal renders inside `InsitoProvider`.

```dart theme={null}
MicroSurvey.trigger('checkout_completed');
```

See [Configure](/sdk/flutter/configure) for the full `InsitoConfig` schema,
[API reference](/sdk/flutter/api-reference) for every method, and the
[example app](https://github.com/VJiri/insito-flutter/tree/main/example) for a
working `MaterialApp` setup with screen tracking.
