GuidesAPI ReferenceChangelog
Log In
Guides

Flutter SDK

Installation

The Flutter plugin for Link is a wrapper for the native Android and iOS SDKs. You can install it from Pinwheel's pub.dev page.

See the included example app for a working demo.

  1. Add the depenedency to pubspec.yaml.

You can use pub.dev:

dependencies:
  pinwheel: ^2.4.0

You can also use git:

dependencies:
  pinwheel:
      git:
        url: git://github.com/underdog-tech/pinwheel-flutter-sdk.git
        ref: main
  1. Import the Pinwheel widget, and models.
import 'package:pinwheel/models.dart';
import 'package:pinwheel/pinwheel.dart';

Build requirements

Android

  • Android minSdkVersion is API 22 or higher.
  • Android Target SDK version: API 30.
  • Android SDK build tools: 26.0.3
  • Android Gradle Plugin: 3.0.0 or greater.

iOS

  • Xcode version: 9.1 or greater.
  • iOS Base SDK: 11.1 or greater.
  • Deployment target: iOS 12.0 or greater.

Usage

  1. Implement any optional callbacks.

Details for the callbacks, and model objects can be found in the lib/models.dart, and lib/pinwheel.dart files. You can read more about Link events to see all available events.

_onExit(PinwheelExitPayload? payload) {
  print(payload);
  Navigator.pop(context);
}

_onEvent(String name, PinwheelEventPayload? payload) {
  print(payload);
}

_onError(PinwheelError error) {
  print(error);
}

_onSuccess(PinwheelSuccessPayload payload) {
  print(payload);
}

_onLogin(PinwheelLoginPayload payload) {
  print(payload);
}
  1. Fetch the Link token from your server.

Follow the getting started guide for details on Link tokens and modal initialization.

  1. Initialize the PinwheelLink StatefulWidget.
PinwheelLink link = PinwheelLink(
  token: payload.token, 
  onExit: _onExit,
  onError: _onError, 
  onEvent: _onEvent,
  onSuccess: _onSuccess,
  onLogin: _onLogin,
);
  1. Show the widget

PinwheelLink is a StatefulWidget that you can display and hide in your app's view hierarchy.

🎉 You're done! You're now ready to test and go live.


What’s Next