# Flutter SDK
URL: https://www.quiltt.dev/connector/sdk/flutter
Description: Integrate Quiltt Connector into your Flutter application with our Flutter SDK. Learn how to install the package and get started with quick examples.
Navigation: connector → sdk → flutter
Tags: Connector, SDKs

The [Quiltt Flutter SDK](https://pub.dev/packages/quiltt_connector) provides a Widget for seamless integration of the Quiltt Connector into your Flutter app.

This SDK currently supports iOS and Android.

Info - Documentation:
For full documentation, additional examples and the source code, see the [Quiltt Flutter SDK on
  GitHub](https://github.com/quiltt/quiltt-sdks/tree/main/packages/flutter#readme).

## Installation

```sh
$ flutter pub add quiltt_connector
```

## Setting up OAuth

Quiltt always prioritizes OAuth-based connections, which require your user to provide consent on their institution's website or app, and then be redirected back to your app. This means that your application needs to be able to gracefully handle this redirect by returning them to the Connector flow in your app.

For production Environments, you must pass a `https://` URL to `appLauncherUrl`. This URL must be a valid App Link (Android) or Universal Link (iOS) that can launch your app, like `https://app.mydomain.com/connect_bank`.

Please see Flutter's guides on [Android App Links](https://docs.flutter.dev/cookbook/navigation/set-up-app-links) and [iOS Universal Links](https://docs.flutter.dev/cookbook/navigation/set-up-universal-links).

For local development, you can use `http://`. We recommend using a tunneling service like Ngrok.

Plaid OAuth Note:

## Handling Authentication

To load the Connector for use by a pre-existing end-user, you'll need to pass a valid Session token. See the [Authentication guides](/authentication) for more information on generating Session tokens.

## Quickstart Example

### Connect and Reconnect with QuilttConnector

Below is an example of `QuilttConnector` usage.

```dart

class _Example extends State {
  connect() {
    QuilttConnectorConfiguration config = QuilttConnectorConfiguration(
      connectorId: "<CONNECTOR_ID>",
      institution: "<OPTIONAL_INSTITUTION_SEARCH_TERM_TO_PREFILL_INSTITUTION>",
      appLauncherUrl: "<YOUR_HTTPS_APP_LINK>",
      themeMode: "auto");

    QuilttConnector quilttConnector = QuilttConnector();
    quilttConnector.authenticate(token); // Optional
    quilttConnector.connect(context,
      config,

      // See the JavaScript API for all available event callbacks
      onEvent: (event) {
        debugPrint("onEvent $[event.type]: $[event.eventMetadata]");
      },
      onExit: (event) {
        debugPrint("onExit $[event.type]: $[event.eventMetadata]");
      },
      onExitSuccess: (event) {
        debugPrint("onExitSuccess: $[event.eventMetadata]");
        _setConnectionId(event.eventMetadata.connectionId!);
      },
      onExitAbort: (event) {
        debugPrint("onExitAbort: $[event.eventMetadata]");
      },
      onExitError: (event) {
        debugPrint("onExitError: $[event.eventMetadata]");
      });
  }

  reconnect() {
    QuilttConnectorConfiguration config = QuilttConnectorConfiguration(
      connectorId: "<CONNECTOR_ID>",
      connectionId: "<CONNECTION_ID>", // To support the Reconnect Flow
      appLauncherUrl: "<YOUR_HTTPS_APP_LINK>",
      themeMode: "auto");

    QuilttConnector quilttConnector = QuilttConnector();
    quilttConnector.authenticate(token); // Optional
    quilttConnector.reconnect(context,
      config,

      // See the JavaScript API for all available event callbacks
      onEvent: (event) {
        debugPrint("onEvent $[event.type]: $[event.eventMetadata]");
      },
      onExit: (event) {
        debugPrint("onExit $[event.type]: $[event.eventMetadata]");
      },
      onExitSuccess: (event) {
        debugPrint("onExitSuccess: $[event.eventMetadata]");
        _setConnectionId(event.eventMetadata.connectionId!);
      },
      onExitAbort: (event) {
        debugPrint("onExitAbort: $[event.eventMetadata]");
      },
      onExitError: (event) {
        debugPrint("onExitError: $[event.eventMetadata]");
      });
  }

  @override
  Widget build(BuildContext context) [return Container();]
}
```