pinwheel 0.0.2 pinwheel: ^0.0.2 copied to clipboard
A flutter plugin for the Pinwheel Link SDK.
Flutter plugin for the Pinwheel SDK #
The Flutter plugin for Pinwheel's Link SDK is a wrapper for the native Android and iOS SDKs and supports Link version 2.3.0.
See the included example app for a working demo.
Before you start #
You will need a Pinwheel developer account, and an API secret before you can use Pinwheel Flutter SDK.
Installation and Usage #
- Add the depenedency to pubspec.yaml.
dependencies:
pinwheel:
git:
url: git://github.com/underdog-tech/pinwheel-flutter-sdk.git
ref: main
- Import the Pinwheel widget, and models.
import 'package:pinwheel/models.dart';
import 'package:pinwheel/pinwheel.dart';
- Implement any callbacks, these are all optional.
Details for the callbacks, and model objects can be found in the lib/models.dart, and lib/pinwheel.dart files.
Read more about Link events on our docs site.
_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);
}
- Fetch the Link token from your server.
Read more about Link tokens in the Implementation overview on our docs site. Do not include your API secret, and fetch Link tokens directly from your app.
- Initialize the PinwheelLink StatefulWidget.
PinwheelLink link = PinwheelLink(
token: payload.token,
onExit: _onExit,
onError: _onError,
onEvent: _onEvent,
onSuccess: _onSuccess,
onLogin: _onLogin,
);
- Show the widget
PinwheelLink
is a StatefulWidget
that you can display and hide in your app's view hierarchy.
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 11.0 or greater.
License #
MIT